Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data stacking in SAS

I want to stack this type of my data set:

PATIENT_ID  AA BB CC DD EE  
1           22 33 44 55 66  
2           77 88 99 10 11  
...         .. .. .. .. .. 

into the following:

 PATIENT_ID GROUP VALUE  
 1          AA    22  
 1          BB    33  
 1          CC    44  
 1          DD    55  
 1          EE    66  
 2          AA    77  
 2          BB    88  
 2          CC    99  
 2          DD    10  
 2          EE    11  
 ...        ..    ..

to check normality for all groups as they are dependent/linked.

How to do this stacking in SAS ? Thank you.

like image 920
abc Avatar asked Jun 27 '26 10:06

abc


1 Answers

Use proc transpose:

data pats;
    input PATIENT_ID  AA BB CC DD EE;
    cards;
1 22 33 44 55 66  
2 77 88 99 10 11
;
run;

proc transpose data=pats out=pats_long;
    by patient_id;
run;
like image 162
itzy Avatar answered Jun 30 '26 20:06

itzy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!