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...!!!
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.