BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
MoZes
Calcite | Level 5

Hello Team,

 

Am in the process of running a multivariate model with several continuous longitudinal responses. Am envisaging a wide format data structure with a number of responses, but currently working with two responses (S and D) as follows;

 

IDS1S2S3S4D1D2D3D4
112412513614077798590
215014514014582838082
314013514213880798278

 

The 'S' and 'D' measurements are taken per individual at four time points (1, 2, 3, 4). The sample data set is from three individuals uniquely identified by 'ID'. Am able to restructure this to a long format  as follows;

IDTSD
1112477
1212579
1313685
1414090
2115082
2214583
2314080
2414582
3114080
3213579
3314282
3413878

 

I now wish to combine the two sequences into one sequence (SDcomb) by a stack up procedure such that the resulting data set will appear as follows;

IDTSDcomb
11124
1177
12125
1279
13136
1385
14140
1490
21150
2182
22145
2283
23140
2380
24145
2482
31140
3180
32135
3279
33142
3382
34138
3478

 

How do I achieve this? Thank you.

 

Kind Regards,

MoZes

1 ACCEPTED SOLUTION

Accepted Solutions
MoZes
Calcite | Level 5

Hi Rick,

 

Thank you so much for helping me out. Have been cracking my head all day, finally sorted. Thanks Bro!

 

Regrads,

MoZes

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ
data have;
input ID	T	S	D;
datalines;
1	1	124	77
1	2	125	79
1	3	136	85
1	4	140	90
2	1	150	82
2	2	145	83
2	3	140	80
2	4	145	82
3	1	140	80
3	2	135	79
3	3	142	82
3	4	138	78
;

data want;
set have;
SDComb = S; output;
SDComb = D; output;
drop S D;
run;
MoZes
Calcite | Level 5

Hi Rick,

 

Thank you so much for helping me out. Have been cracking my head all day, finally sorted. Thanks Bro!

 

Regrads,

MoZes

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1505 views
  • 0 likes
  • 2 in conversation