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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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