Hi There,
First, let's assume that you have working code that accurately creates the data set LOAN_11. There are several areas where the syntax is questionable, so it may have been copied incorrectly in the posted code.
The SUM function does not summarize across observations. It sums up within a single observation only. To get the rate that you are asking for, I would guess you are looking for:
proc means data=loan_11 mean;
var loan_status2;
run;
The mean value for LOAN_STATUS2 will be the percent of loans that are in default.
As a general rule, think about using a procedure, not a DATA step, to summarize across observations.
First, let's assume that you have working code that accurately creates the data set LOAN_11. There are several areas where the syntax is questionable, so it may have been copied incorrectly in the posted code.
The SUM function does not summarize across observations. It sums up within a single observation only. To get the rate that you are asking for, I would guess you are looking for:
proc means data=loan_11 mean;
var loan_status2;
run;
The mean value for LOAN_STATUS2 will be the percent of loans that are in default.
As a general rule, think about using a procedure, not a DATA step, to summarize across observations.
Thank you very much Super User. It worked fine.
If you have listed all of the values for loan_status in your code you might find this interesting.
proc format; value $default 'Late (31-120 Days)', 'Default' ='In Default' 'Current', 'Late (16-30 Days)', 'In Grace Period', 'Charged Off', 'Fully Paid' = 'Not Default' ; run; proc freq data=Loan_1; tables loan_status; format loan_status $default.; run;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: