Hi!
I am a new user to SAS and was wondering how I go about transposing my dataset. It currently looks like the following:
continent industry total
A 0509 37
B 0509 78
C 0509 12
A 1315 85
B 1315 26
C 1315 73
and I need it to look something like this:
continent
industry variable A B C
0509 total 37 78 12
1315 total 85 26 73
Should I use proc transpose? Apologies if this is very simple, I am very new to SAS !! 🙂
Thank you!
To get the variable names you want, the transpose as suggested by @Amir needs some additions:
proc transpose
data=have
out=want (rename=(_name_=variable))
;
by industry;
id continent;
run;
Hi,
How about:
proc transpose data = have
out = want;
by industry;
run;
Regards,
Amir.
To get the variable names you want, the transpose as suggested by @Amir needs some additions:
proc transpose
data=have
out=want (rename=(_name_=variable))
;
by industry;
id continent;
run;
That works perfectly - thank you so much!
@Kurt_Bremser wrote:
To get the variable names you want, the transpose as suggested by @Amir needs some additions:
proc transpose data=have out=want (rename=(_name_=variable)) ; by industry; id continent; run;
PROC TRANSPOSE has a PROC statement option NAME= to give a name to the "variable name" variable. Kind of a 6 of 1 half dozen thing regarding which to use.
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.