The functional analysis proceeds in two steps. First, a DATA STEP is used to create a 'Count' variable based on credit qualification ('Credit_Qualification'). If the qualification is 'N/A', the counter is 0; otherwise, it is 1. This step prepares the data for counting. Second, the 'freqTab.freqTab' action of PROC CAS is used to generate a frequency table of the 'Credit_Qualification' variable, using the 'Count' variable as a weight. This allows determining the percentage of qualified individuals based on their qualification status.
Data Analysis
Type : CREATION_INTERNE
The examples use data generated via a DATA STEP with datalines to simulate the 'mycaslib.creditqualify' table.
1 Code Block
DATA STEP Data
Explanation : This code block first creates an example data table named 'mycaslib.creditqualify' with CustomerID and Credit_Qualification variables. Then, it creates a new table 'mycaslib.qualifyapps' from 'mycaslib.creditqualify'. A new 'Count' variable is added: it takes the value 0 if 'Credit_Qualification' is 'N/A', and 1 otherwise. This prepares a numerical field for counting valid qualifications.
Copied!
data mycaslib.creditqualify;
infile datalines;
input CustomerID Credit_Qualification $;
datalines;
1 A
2 N/A
3 B
4 A
5 N/A
6 C
;
run;
data mycaslib.qualifyapps;
set mycaslib.creditqualify;
if Credit_Qualification='N/A' then Count=0;
else Count=1;
run;
1
DATA mycaslib.creditqualify;
2
INFILEDATALINES;
3
INPUT CustomerID Credit_Qualification $;
4
DATALINES;
5
1 A
6
2 N/A
7
3 B
8
4 A
9
5 N/A
10
6 C
11
;
12
RUN;
13
14
DATA mycaslib.qualifyapps;
15
SET mycaslib.creditqualify;
16
IF Credit_Qualification='N/A'THEN Count=0;
17
ELSE Count=1;
18
RUN;
2 Code Block
PROC CAS (action freqTab.freqTab)
Explanation : This code block uses the CAS procedure to execute the 'freqTab.freqTab' action. This action generates a frequency table for the 'Credit_Qualification' variable from the previously created 'qualifyapps' table. The 'Count' variable is specified as a weight, which allows totaling the counts for each 'Credit_Qualification' category, thereby determining the percentage of credit-qualified individuals.
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.