SAS Studio

Write and run SAS programs in your web browser
BookmarkSubscribeRSS Feed
xshinbrot0
Calcite | Level 5

Hi there,

 

I am interested in figuring out how to transform my data set so I can use a repeated measures ANOVA.

 

Right now I have an excel spreadsheet uploaded into SAS studio. It is now organized as this example, where there is a subject, a group trial, and time (pre, post- 1 week, post 1 month and control), with the dependent variable being the amount of learning. Now to use repeated measures I want to make sure that there is the assumption that time 1,2,3 are correlated (since its the same person). I read here that I will need to transform it so that all the dependent variables are on the same line (e.g. subject 1 would have 15, 19, 25 on one line). I don't understand how to do that in SAS. I can't just make up "ave_learn1" "ave_learn2" "ave_learn3" can I? How do I do this? Please advise. 

 data Old;
      input Subject Group Time ave_learn;
   datalines;
    1 1 1 15
    1 1 2 19
    1 1 3 25
    2 1 1 21
    2 1 2 18
    2 1 3 17
    1 2 1 14
    1 2 2 12
    1 2 3 16
    2 2 1 11
    2 2 2 20

 

2 REPLIES 2
ballardw
Super User

Is subject 1 in group 1 and in group 2 supposed to be the same individual?

 

proc sort data=old;
by subject group;
run;

proc transpose data =old out=new prefix=t;
   by subject group;
   id time;
   var ave_learn;
run;
xshinbrot0
Calcite | Level 5

The way that I have it yes, it has the subject id with three lines of code (subject=1, pre-survey time=1; subject=1 postsurvey time=2; subject=1 postsurvey time=3), Let me try that code though, thank you!

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 1563 views
  • 0 likes
  • 2 in conversation