BookmarkSubscribeRSS Feed
ArthurMa
Fluorite | Level 6

Dear friends of SAS community

 

I am confused by how to output the corrected original data set in covariance anlysis using proc mixed. I need the corrected original data for further repeated meassure and factorial analysis, as I carried out the covariance anlysis using one way treatment design, but the experiment is carried out as factorial design with repeated meassure. I believe a slight change of my code should do it. here is my code below:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

data exercise;
 
input trt$ adg iwt; /*iwt is the covariance*/
 
cards;
 
hfhs 23.21 38.92
hfhs 1.18 39.65
hfhs 8.09 38.8
hfhs 29.84 39.7
hfhs 89.89 38.45
hfhs 5.86 39.61
hfhs 1.67 39.1
hfhs 88.98 38.77
hfhs null null
hfhs 21.88 39.42
hfcon 95.81 37.76
hfcon 97.89 37.68
hfcon 97.88 38.14
hfcon 99.67 38.08
hfcon 99.58 37.42
hfcon 97.63 37.93
hfcon 96.74 38.32
 
hfcon 97.15 38.1
hfcon 91.10 38.26
lfhs 96.03 39.13
lfhs 59.53 38.98
lfhs 7.74 38.71
lfhs 9.92 38.8
lfhs 93.85 38.44
lfhs 6.79 38.84
lfhs 94.77 38.16
lfhs 6.37 39.18
lfhs 92.64 38.31
lfhs 16.74 38.64
lfcon 95.05 37.7
lfcon 97.29 38.46
lfcon 94.11 38.7
lfcon 98.08 38.88
lfcon 99.69 38.16
lfcon 99.62 38.11
lfcon 82.47 38.44
lfcon 98.20 37.94
lfcon 99.66 38.24
lfcon 98.52 37.95
 
;
 
proc mixed data=exercise covtest;/*check if covariance is significant, the answer is yes*/
 
class trt;
 
model adg=trt trt*iwt/noint solution;
 
run;
proc mixed data=exercise covtest;/*check if equal slope or not, the answer is yes*/
 
class trt;
 
model adg=trt iwt trt*iwt/solution;
 
run;
proc mixed data=exercise covtest;/*apply covariacne correction*/
 
class trt;
 
model adg=trt iwt/solution ;
 
lsmeans trt/adjust=tukey;
 
ods output diffs=ppp lsmeans=mmm;
ods listing exclude diffs lsmeans;
 
run;
%include'd:\pdmix800.sas';
%pdmix800(ppp,mmm,alpha=.05,sort=yes);/*apply sas macro*/
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I sincerely appreciate all the assistance you are about to offer!
6 REPLIES 6
Rick_SAS
SAS Super FREQ

I have never used the %PDMIX800 macro, but you can use PROC PLM and the LSMEANS statement to get a graphical display that reveals which treatment effects are significantly different. Here is the code for your example:

proc mixed data=exercise covtest;/*apply covariacne correction*/
   class trt;
   model adg=trt iwt/solution ;
   store out=mixedout;
run;

ods graphics on;
proc plm restore=mixedout;
   lsmeans trt/ pdiff=all adjust=tukey linestable;
run;

The output includes a diffogram by default. The LINESTABLE option produces a table with letters that show which effects are significantly different. 

ArthurMa
Fluorite | Level 6

Thank you for your reply and introducing me proc PLM, but it wasn't really what I was confused of. I have clarified my concerns below, please check.

 

In covariance analysis, there were original data (adg) and covariance (iwt), after we gave SAS those data, SAS would calculate if covariance (iwt) significantly influenced the out come original data (adg) or not, in my case, it's yes. Then SAS would provide an equation (Like linear regression) to calculate the covariance corrected data(it is more accurate for further analysis), and those corrected data would be used for the final anova and tukey test. I was trying to get the corrected data because my experiment requires repeated meassure, but using the equation to calculate myself would be really hard, since SAS would use the corrected data for the final analysis, I think SAS is capable of outputting the corrected data.

jiltao
SAS Super FREQ

I am not sure you mean by covariance corrected original data. Can you please clarify?

Thanks,

Jill

ArthurMa
Fluorite | Level 6

In covariance analysis, there were original data (adg) and covariance (iwt), after we gave SAS those data, SAS would calculate if covariance (iwt) significantly influenced the out come original data (adg) or not, in my case, it's yes. Then SAS would provide an equation (Like linear regression) to calculate the covariance corrected data(it is more accurate for further analysis), and those corrected data would be used for the final anova and tukey test. I was trying to get the corrected data because my experiment requires repeated meassure, but using the equation to calculate myself would be really hard, since SAS would use the corrected data for the final analysis, I think SAS is capable of outputting the corrected data.

jiltao
SAS Super FREQ

For repeated measures data, you can use PROC MIXED/PROC GLIMMIX to model the covariance in the data, and the tests for the fixed effects would account for the covariance. This is done in one-step in these procedures. You do not need to have so called covariance corrected original data then use that for subsequent ANOVA analysis.

Thanks,

Jill

ArthurMa
Fluorite | Level 6
Thank you for your reply, it means a lot. I am starting to understand those.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 6 replies
  • 502 views
  • 4 likes
  • 3 in conversation