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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.