Hello, I have searched for the answer to my problem but to no avail. I have a longitudinal dataset that looks like this:
Each subject currently has five repeated measures (at time points 0-4). I would like to take the variable on the left ("recall_trial6") and append it the variable on the right ("recall"), in essence, adding a repeated measure. At the same time, I would need to add another time point to "trial" so that it runs from 0-5. Any help or tips are greatly appreciated!
Subject Trial Recall
1 0 9
1 1 14
1 2 19
1 3 21
1 4 20
1 5 23
2 0 4
2 1 7
2 2 11
2 3 13
2 4 16
2 5 12
... ... ...
data want; set have; by id; output; if last.id then do; trial = 5; recall=recall_trial6; output; end; *keep id trial recall; run;
This should work then.
@tbanh wrote:
Hello, I have searched for the answer to my problem but to no avail. I have a longitudinal dataset that looks like this:
Each subject currently has five repeated measures (at time points 0-4). I would like to take the variable on the left ("recall_trial6") and append it the variable on the right ("recall"), in essence, adding a repeated measure. At the same time, I would need to add another time point to "trial" so that it runs from 0-5. Any help or tips are greatly appreciated!
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.