BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Q1983
Lapis Lazuli | Level 10

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

like this?

data WANT;
  merge HAVE(where=(STATUS='Current'))
        HAVE(where=(STATUS='PastDue') rename=(CURRENT=CUR2 PAST=PAST2));
  by MONTH;
run;

 

 

View solution in original post

2 REPLIES 2
ChrisNZ
Tourmaline | Level 20

like this?

data WANT;
  merge HAVE(where=(STATUS='Current'))
        HAVE(where=(STATUS='PastDue') rename=(CURRENT=CUR2 PAST=PAST2));
  by MONTH;
run;

 

 

ed_sas_member
Meteorite | Level 14

Hi @Q1983 

Could you please show us the expected output?

 

Best,

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 584 views
  • 1 like
  • 3 in conversation