Hi
Using SAS 7.1.
I only have 1 variable, but instead of presenting in column, I want in ROWS. How do I do that?
Thanks!
Would it be possible to share some of your data as sample and tell us how you expect the output to look like?
Hi,
THank you for the reply.
I have attached a sample.
I could do a transpose paste in excel, but as I have many tables it becomes tedious. Hence would prefer that SAS generate the tables as ROWS.
THank you
Here is something you may clone to your specific needs.... This is just one way of getting the output you desire... a bit lengthy but simple code....
data have;
input v1:$5. v2:$5. v3:$5. v4:$5.;
datalines;
Tom Peter Henry Jack
100 101 102 103
;
run;
data name;
set have;
if _n_ = 1;
run;
proc transpose data=name out=names(drop=_name_);
var v1 v2 v3 v4;
run;
data id;
set have;
if _n_ = 2;
run;
proc transpose data=id out=ids(drop=_name_);
var v1 v2 v3 v4;
run;
data final;
set names(rename=(col1=name));
set ids(rename=(col1=id));
run;
proc print data=final;
run;
It produces the following output for your reference...
Obs name id
1 Tom 100
2 Peter 101
3 Henry 102
4 Jack 103
Hope this helps...!!! Good Luck...!!!
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.