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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.