This dataset was imported from an excel file.
raw SAS dataset as the follows:
ID v1 v2
12 2 3
. 3 4
. 8 9
41 2 3
. 3 4
. 8 9
. 3 4
. 8 9
14 2 3
. 3 4
. 8 9
data wanted:
ID v1 v2
12 2 3
12 3 4
12 8 9
41 2 3
41 3 4
41 8 9
41 3 4
41 8 9
14 2 3
14 3 4
14 8 9
Any easier way to do this ? thanks
One way:
data want;
set have;
retain new_id;
if id ne . then new_id=id;
drop id;
rename new_id=id;
run;
Good luck.
One way:
data want;
set have;
retain new_id;
if id ne . then new_id=id;
drop id;
rename new_id=id;
run;
Good luck.
Thanks Astounding. :smileylaugh:
This is basically an LOCF problem and if you have more that a couple of variables that need to be carried forward you might find this helpful.
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.