BookmarkSubscribeRSS Feed
wfung
Fluorite | Level 6

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
Opal | Level 21

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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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