Help using Base SAS procedures

transposition using PROC REPORT

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

transposition using PROC REPORT

Is there a way to do the transposition below using PROC REPORT?


Accepted Solutions
Solution
‎12-04-2014 11:12 PM
SAS Super FREQ
Posts: 8,864

Re: transposition using PROC REPORT

Hi, it depends on the structure of what you have. PROC REPORT will not directly "stack" 2 separate variables like NUMER and DENOM in 2 separate rows. So if NUMER and DENOM are diff variables, then the answer is yes, but with some data manipulation first. If NUMER and DENOM are both values of an ACROSS item, then it would be easier.

  See the 2 transpose examples at the beginning of this paper. http://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf

cynthia

View solution in original post


All Replies
Contributor
Posts: 35

Re: transposition using PROC REPORT

Sorry, forgot the attachments.

Have:

have.PNG

Want:

want.PNG

Solution
‎12-04-2014 11:12 PM
SAS Super FREQ
Posts: 8,864

Re: transposition using PROC REPORT

Hi, it depends on the structure of what you have. PROC REPORT will not directly "stack" 2 separate variables like NUMER and DENOM in 2 separate rows. So if NUMER and DENOM are diff variables, then the answer is yes, but with some data manipulation first. If NUMER and DENOM are both values of an ACROSS item, then it would be easier.

  See the 2 transpose examples at the beginning of this paper. http://support.sas.com/resources/papers/proceedings14/SAS388-2014.pdf

cynthia

Contributor
Posts: 35

Re: transposition using PROC REPORT

Posted in reply to Cynthia_sas

Thanks.  I'm able to do it when I normalize the data first.  There's not a (less easier) way to do it if NUMER and DENOM are two different variables?

proc report transposition.PNG

SAS Super FREQ
Posts: 8,864

Re: transposition using PROC REPORT

Not with PROC REPORT. You'd have to try TABULATE or DATA Step program with 2 separate variables.

cynthia

Super User
Posts: 11,343

Re: transposition using PROC REPORT

I'm not going to retype your code to test but

proc tabulate data=have; /*your original data layout from the second post*/

     class mc / missing;

     var numer denom;

     table (numer denom) * max=' '*f=best5. ,

              mc='';

run;

might get close.

Warning: Proc tabulate does not have a display value approach, a statistic pretty much must be requested unless all you want is a count. The code I have will summarize. So probably will not yield desired result if there are duplicate values for MC.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 246 views
  • 3 likes
  • 3 in conversation