Dear,
I have a question. When I run the program, for the ID=2 subject: I am getting atm and btm values in col1 and col2. Is there any better way that I can use to get both values in col1 in one step. I am doing two additional datasteps to get the output I need. Thank you. Please suggest
data one; input id fn $ v$ atm $5. +1 btm $5.; datalines; 1 s v1 10:00 2:00 2 s v1 10:30 3:00 2 s v1 10:00 2:00 3 s v1 10:30 3:00 ; proc transpose data=one out=two; var atm btm; by id fn v; run;
Post exactly what you want the output to look like please.
Like this:
data one;
input id fn $ v$ atm $5. +1 btm $5.;
datalines;
1 s v1 10:00 2:00
2 s v1 10:30 3:00
2 s v1 10:00 2:00
3 s v1 10:30 3:00
;
data temp;
set one;
obs + 1;
run;
proc transpose data=temp out=two(drop=obs);
var atm btm;
by id fn v obs;
run;
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 how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.