data have;
length status $25.;
input status Month Current Past;
return;
datalines;
Current 2 1 0
Current 3 1 0
PastDue 2 0 1
PastDue 3 0 1
;
run;
I need to be able to compare the Current and PastDue numbers by Status and Month
As an example Current in Month 2 is 1 and I want to place it in the same row as PastDue in Month 2 which is a 0. If I do a proc transpose the data will show in a diagnol due to the presence of 0 if there is no match
like this?
data WANT;
merge HAVE(where=(STATUS='Current'))
HAVE(where=(STATUS='PastDue') rename=(CURRENT=CUR2 PAST=PAST2));
by MONTH;
run;
like this?
data WANT;
merge HAVE(where=(STATUS='Current'))
HAVE(where=(STATUS='PastDue') rename=(CURRENT=CUR2 PAST=PAST2));
by MONTH;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.