Hi,
i have data set like:
data test;
input name $ PAID_status $;
datalines;
AMAN Y
PAWAN Y
KUMAR N
TIWARI Y
MINU N
DEEPAK N
RAHUL Y
VISHAL N
POOJA Y
PAYAL Y
goyal N/A
BALAK N
;
RUN;
now i m looking to generate report like :
report of 11 student
Name paid_status
AMAN Y
PAWAN Y
KUMAR N
TIWARI Y
MINU N
DEEPAK N
RAHUL Y
VISHAL N
POOJA Y
PAYAL Y
BALAK N
6 student paid and 5 student not paid out of 11 student.
PLZ HELP
Do you know how to create macro variables?
yes, %let n call symput();
but not able to use logic how to use it here..
Try doing it via proc sql:
http://www.ats.ucla.edu/stat/sas/library/nesug99/cc107.pdf
The trick is to get the summary values you need and then use those to create the macro variables.
You could do it multiple ways:
1) one sql step
OR
2) Use proc means to get the output with the total and count for each group and use that data set and call symput to create your macro variables.
count n total is nt a prob for me , i hav done that already.
DATA TEST1;
SET TEST END = FINAL;
IF STATUS = 'Y' THEN Y+1;
IF STATUS= 'N' THEN N+1;
TOT+1;
RUN;
PROC PRINT;
RUN;
main prob is using that in title n footnote.
Create macro variables with call symput using your data then.
DATA TEST1;
SET TEST END = FINAL;
IF STATUS = 'Y' THEN Y+1;
IF STATUS= 'N' THEN N+1;
TOT+1;
if final then do;
call symput('num_yes', y);
call symput('num_no', n);
end;
RUN;
title "num of yes: &num_yes. and number of no: &num_no.";
DATA TEST1;
SET TEST END = FINAL;
IF STATUS = 'Y' THEN Y+1;
IF STATUS= 'N' THEN N+1;
TOT+1;
if final then do;
call symput('num_yes', y);
call symput('num_no', n);
call symput('Tot',tot);
end;
RUN;
proc print;
title "&num_yes. student are paid and %sysfunc(left(&num_no.)) students are not paid out of: %sysfunc(left(&tot.)) students";
run;
Thanks.. one more thing plz let me know how to reset footnote. i m nt giving any footnote in my code but still its giving last footnote.
footnote;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.