BookmarkSubscribeRSS Feed
gus7825
Calcite | Level 5

I'm trying to create code for my analysis but do not have the data yet. I have to provide the code for a project but will use it later. 

 

data will consist of 3 measures of CAR, repeated over time. Trauma (high vs. low) should predict CAR over time (3 time points measured). Does this syntax make sense? I'd like to graph it and get output for this.

 

data long ;

  set wide;

  CAR = CAR1; time = 1; output;

  CAR = CAR2; time = 2; output;

  CAR = CAR3; time = 3; output;

  DROP CAR1 – CAR3 ;

run;

proc print data=long ;

run;

proc mixed data=long;

  class sub trauma time;

   model CAR = trauma time trauma*time;

   repeated time / SUBJECT=sub TYPE=CS;

run;

goptions reset=all;

symbol1 c=blue v=star h=.8 i=j;

symbol2 c=red v=dot h=.8 i=j;

axis1 label =(a=90 ‘Means’)

axis2 label =(‘Time’) value = (‘1’ ‘2’ ‘3’);

proc gplot data=means;

  plot lsmean*_ name_ =group/ vaxis=axis1 haxis=axis2;

run;

quit;

3 REPLIES 3
Rick_SAS
SAS Super FREQ

You seem to want to create a plot of the LSMEANS statistics, but the PROC MIXED code that you post does not generate any output.

 

Please provide the code that generates the LSMEAN, _NAME_, and GROUP variables that you want to graph.

gus7825
Calcite | Level 5

Thanks for the response! Does this make more sense?

 

data long ;

  set wide;

  CAR = CAR1; time = 1; output;

  CAR = CAR2; time = 2; output;

  DROP CAR1 – CAR2 ;

run;

proc print data=long ;

run;

proc mixed data=long method=ml covtest;

  class sub trauma time;

   model CAR = trauma time trauma*time;

   repeated time / SUBJECT=sub TYPE=CS;

  lsmeans trauma*time/ adjust=tukey;

run;

Proc plm restore=long;

  effectplot slicefit(x=time sliceby=trauma);

run;

Rick_SAS
SAS Super FREQ

If you want to use PROC PLM to create an effect plot, you need to use the STORE statement in PROC MIXED:
STORE MixStore;

 

Then use that name on the RESTORE= option in PROC PLM:

Proc plm restore=MixStore;
effectplot slicefit(x=time sliceby=trauma);
run;

 

However, the SLICEFIT statement expects the X= variable to be a continuous variable, but you have specified the TIME is a classification variable. Therefore the syntax you've written will generate an error.

 

You might want to read the article "Visualize a mixed model that has repeated measures or random coefficients."

I don't know what you are trying to accomplish, but here is some code that visualizes the model averaged over the subjects:

 

proc mixed data=long method=ml covtest;
  class sub trauma;
  model CAR = trauma time trauma*time;
  repeated / SUBJECT=sub TYPE=CS;
  store MixStore;
run;
quit;

Proc plm restore=MixStore;
  effectplot slicefit(x=time sliceby=trauma);
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 987 views
  • 0 likes
  • 2 in conversation