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!
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.