BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dataMart87
Quartz | Level 8

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

5 REPLIES 5
dataMart87
Quartz | Level 8

Sorry, forgot the attachments.

Have:

have.PNG

Want:

want.PNG

Cynthia_sas
SAS Super FREQ

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

dataMart87
Quartz | Level 8

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

Cynthia_sas
SAS Super FREQ

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

cynthia

ballardw
Super User

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 1003 views
  • 3 likes
  • 3 in conversation