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
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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 1 reply
  • 606 views
  • 0 likes
  • 2 in conversation