BookmarkSubscribeRSS Feed
tbanh
Fluorite | Level 6

Hello, I have searched for the answer to my problem but to no avail. I have a longitudinal dataset that looks like this:

 

Screen Shot 2019-06-17 at 9.05.31 AM.png

 

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!

3 REPLIES 3
Reeza
Super User
Given the expected input above, please show the expected output.
tbanh
Fluorite | Level 6

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

...                     ...                 ...

 

Reeza
Super User
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:

 

Screen Shot 2019-06-17 at 9.05.31 AM.png

 

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!


 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 742 views
  • 0 likes
  • 2 in conversation