BookmarkSubscribeRSS Feed
wfung
Obsidian | Level 7

I have a repeated measures dataset with mutiple variables (i.e., one variable per wave of data collection; Wave1_score, Wave2_score, Wave3_score). Is there a way to convert the data to multiple records (i.e., one row per data collection). 

Thank you! 

 

This is an example of what I have now: 

IDGrade_Wave1Score_Wave1Score_Wave2Score_Wave3
PL240812G15587
PL240812G24589
PL240813G15588
PL240815G16589
PL240817G17599

 

 

I want to convert the data to this: 

IDSchoolGrade_Wave1Score_Wave123Wave
PL240812G11551
PL240812G11582
PL240812G11573
PL240812G21451
PL240812G21482
PL240812G21493
PL240813G12551
PL240813G12582
PL240813G12583
PL240815G12651
PL240815G12682
PL240815G12693
PL240817G13751
PL240817G13792
PL240817G13793
1 REPLY 1
Astounding
PROC Star

Assuming that SCHOOL is actually part of your data set, here's a way:

 

data want;

set have;

array scores {3} score_wave1 - score_wave3;

do wave=1 to 3;

   score_wave123 = scores{wave};

   output;

end;

drop score_wave1 - score_wave3;

run;

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 971 views
  • 0 likes
  • 2 in conversation