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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.