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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.