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...!!!
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.