I have a dataset with 10 observations per subject. I want to create a copy of the first observation so that new datset will contain 11 observations per subject.
Thanks
Thats just controlling the output statement:
data want; /* assumes sorted!! */
set have;
by subject;
if first.subject then do;
output;
output;
end;
else output;
run;
The above will output two rows if first.subject. Note needs to be sorted by subject and then the rows in the order you want.
Thats just controlling the output statement:
data want; /* assumes sorted!! */
set have;
by subject;
if first.subject then do;
output;
output;
end;
else output;
run;
The above will output two rows if first.subject. Note needs to be sorted by subject and then the rows in the order you want.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.