BookmarkSubscribeRSS Feed
mvdnho2
Calcite | Level 5

Dear all, 

 

I am investigating subjective stress levels during a psychosocial stress test. I ran into problems with a more complex model, and started with simplifying my model to figure out the source of the issues. I am already running into trouble by adding a quadratic term of time. 

 

My code is as follows: 

 

proc mixed data=MAST_long_VAS;
class PPID Time;
model BC_stress = Time Time*Time / solution residual influence;
repeated Time / subject=PPID type=ar(1);
run;

 

This model runs without any problems or warnings, but does not give me the output for the fixed effect of Time*Time (only the fixed effect of Time). I tried removing "Time" from the class statement, but then I get the warning that only class variables are allowed in the repeated statement. Can anyone help me with this? 

 

Thanks in advance! 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Time*Time is only meaningful for numeric variables. It has no meaning (mathematically) for class variables, you can't square a class variable, you can only square a numeric (i.e. non-class) variable.

--
Paige Miller
mvdnho2
Calcite | Level 5
Thank you, this is of course true. I found the solution in the meantime: create a duplicate variable of time, one which you can use in the class and repeated statement, while the other can be used in the model statement.
PaigeMiller
Diamond | Level 26

I am not sure this is a legitimate analysis or not, to have TIME in the MODEL statement as a numeric variable, and a different variable which is the same TIME but categorical, in the REPEATED statement. I am going to have to think about this.

--
Paige Miller
StatsMan
SAS Super FREQ

Yes, you can create a copy of the TIME variable to use as a place holder on the REPEATED statement. Call the copy of the TIME variable TIME_C or something that reminds you that you are using this effect only on the REPEATED statement to indicate the order of the time responses. TIME on the MODEL statement and/or RANDOM statement. TIME_C as the repeated effect before the slash on the REPEATED statement. 

SteveDenham
Jade | Level 19

Have you considered using PROC GLIMMIX, as in the following:

 

proc glimmix data=MAST_long_VAS;
class PPID Time;
model BC_stress = Time Time*Time / solution;
random _residual_ / subject=PPID type=ar(1);
run;

In large part, this is adapted from the example - Example 22.10 Correlation and Covariance Matrices in Using the Output Delivery System documentation.

 

SteveDenham

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 666 views
  • 0 likes
  • 4 in conversation