The example proceeds in two steps. First, a DATA step is used to create a new table `mycaslib.qualifyapps` based on an existing table `mycaslib.creditqualify`. A new variable `Count` is added, taking the value 0 if 'Credit_Qualification' is 'N/A' and 1 otherwise. Second, the `freqTab.freqTab` action of PROC CAS is employed to generate a frequency table for the 'Credit_Qualification' variable, using the 'Count' variable as a weight. This allows determining the percentage of people qualified for credit.
Data Analysis
Type : CREATION_INTERNE
The examples use data (mycaslib.creditqualify) that is assumed to exist in the CAS library 'mycaslib'. The first step creates a new table (mycaslib.qualifyapps) from it, to be used in the second step. To make the example self-contained, the 'mycaslib.creditqualify' table should be created or be a SASHELP dataset.
1 Code Block
DATA STEP Data
Explanation : This DATA step code creates a new table named `mycaslib.qualifyapps`. It reads data from `mycaslib.creditqualify` and adds a `Count` variable. If 'Credit_Qualification' is 'N/A', `Count` is set to 0; otherwise, `Count` is set to 1.
Copied!
data mycaslib.qualifyapps;
set mycaslib.creditqualify;
if Credit_Qualification='N/A' then Count=0;
else Count=1;
run;
1
DATA mycaslib.qualifyapps;
2
SET mycaslib.creditqualify;
3
IF Credit_Qualification='N/A'THEN Count=0;
4
ELSE Count=1;
5
RUN;
2 Code Block
PROC CAS
Explanation : This section uses the `freqTab.freqTab` action of PROC CAS to generate a frequency table. It takes the `qualifyapps` table created previously, uses the `Count` variable as a weight, and calculates frequencies for the `Credit_Qualification` variable. This allows obtaining the distribution of credit qualifications.
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.