BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mosthamed
Calcite | Level 5

I have a date of 20 individuals treated with combinations of tow substances

So I have four treatments and I have three measurements:

  1. Body weight (measured three times with one week interval between each time / repeated measurement)

  2. J, measured on time only

  3. K, measured one time only

My data looks like this:

ID  T1  T2  BW0 BW1 BW2      J   K
------------------------------------
1   1   1   675 600 888     114 100
2   1   1   745 653 987     102 100
3   1   1   570 875 885     88  100
4   1   1   510 890 890     91  120
5   1   1   515 870 915     127 169
6   2   1   390 810 935     94  158
7   2   1   410 770 965     146 134
8   2   1   385 725 900     141 149
9   2   1   240 625 750     113 168
10  2   1   545 845 985     103 169
11  1   2   510 840 890     94  158
12  1   2   110 285 900     146 134
13  1   2   500 860 790     141 149
14  1   2   150 335 425     113 168
15  1   2   30  195 215     103 149
16  2   2   135 200 235     94  168
17  2   2   500 625 690     146 169
18  2   2   40  195 345     141 158
19  2   2   740 920 80      113 134
20  2   2   465 650 800     103 149

I am using SAS, and I going to analyze the body weight as repeated measurement.

The two other measures will be analyzed using Proc mixed of SAS.

The model is

proc mixed; 
class T1 T2 ; 
model K = T1 T2 T1*T2 ;
random ID;
run;

Can anyone correct my model for the last two measurements,

and suggest how I can analyze the repeated measures using SAS?

1 ACCEPTED SOLUTION

Accepted Solutions
jiltao
SAS Super FREQ

For variables J and K, where you only have one measurement per ID, you should not use the RANDOM ID; statement in there.

 

For variable BW, you would need to reconstruct your data --

data new;

   set old;

   bw=bw0; time=0; output;

   bw=bw1; time=1; output;

   bw=bw2; time=2; output;

  drop bw0 bw1 bw2 j k;

run;

Then use PROC MIXED with a sample syntax as below --

proc mixed data=new;

   class T1 T2;

   model bw = T1 T2 T1*T2;

   repeated time / subject=ID type=un; ** or type=ar(1) or cs or another covariance structure;

run;

Hope this helps,

Jill

View solution in original post

3 REPLIES 3
jiltao
SAS Super FREQ

For variables J and K, where you only have one measurement per ID, you should not use the RANDOM ID; statement in there.

 

For variable BW, you would need to reconstruct your data --

data new;

   set old;

   bw=bw0; time=0; output;

   bw=bw1; time=1; output;

   bw=bw2; time=2; output;

  drop bw0 bw1 bw2 j k;

run;

Then use PROC MIXED with a sample syntax as below --

proc mixed data=new;

   class T1 T2;

   model bw = T1 T2 T1*T2;

   repeated time / subject=ID type=un; ** or type=ar(1) or cs or another covariance structure;

run;

Hope this helps,

Jill

mosthamed
Calcite | Level 5
Thank you for the detailed answer
should I add time to class
as I got an error
"ERROR: Only class variables allowed in this effect."
jiltao
SAS Super FREQ

Sorry I missed specifying Time as a Class variable. Yes, you should specify TIME in the CLASS statement. If you want to test for the TIME effect, you could also add Time in your MODEL statement in PROC MIXED.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 738 views
  • 2 likes
  • 2 in conversation