PROC TRANPOSE....
data have;
input Id (Prod1 Prod2 Prod3)($);
cards;
1 A B C
2 D E F
;;;;
run;
proc transpose
name = NewVar1
data = have
out = need(rename=(col1=NewVar2))
;
by id;
var prod:;
run;
proc print;
run;
New New
Obs Id Var1 Var2
1 1 Prod1 A
2 1 Prod2 B
3 1 Prod3 C
4 2 Prod1 D
5 2 Prod2 E
6 2 Prod3 F
Modified to NAME new variables created by TRASNSPOSE
Message was edited by: data _null_;
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.