Is there a way to do the transposition below 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
Sorry, forgot the attachments.
Have:
Want:
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
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?
Not with PROC REPORT. You'd have to try TABULATE or DATA Step program with 2 separate variables.
cynthia
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.
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.
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.