- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am having a hard time understanding the ANCOVA model and how to implement it in SAS.
I am supposed to do an ANCOVA to obtain adjusted means and adjusted means differences for Y = change from baseline using treatment as a factor variable (3 categories), country as a categorical covariate (5 categories) and baseline as a continuous variable (hence the need for ANCOVA), the last two being adjustment variables.
I have to use proc mixed and not proc glm or proc reg (Although I would love to know how it's done using these models as well).
My SAS code looks something like:
proc mixed data = mydata;
ods output lsmeans = ls_means;
class trt country;
model change = trt country baseline;
lsmeans trt / pdiff cov ;
run;
Is this correct? I also learned that an ANCOVA model requires the centering of the continuous variable. Is this something that has to be done manually or is it automatically done through SAS? I read somewhere that SPSS and R do it automatically. I know that the ANCOVA model looks something like this:
How do I write my model in this form(knowing that I have an extra categorical adjustment variable)? Or can I just write it as a regression model:
Change = Bo + B1 treat1 + B2 treat2 + B3 country1 + B4 country2 + B5 country3 + B6 country4 + B7 baseline + error (treat 3 = ref and country5 = ref)?
One last thing : I am supposed to do a sequential comparison.
Treat 1 vs Treat 3
Treat 2 vs Treat 3
Treat 1 vs Treat 2
How do I do that in SAS? Do I use the estimate options? I'm not too sure how that works either.
Any and all help would be appreciated!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I think the code you provided works for ANCOVA.
I don't think centering of the continuous variable is required; SAS does not do this automatically.
The PDIFF option of LSMEANS gets you the comparisons of the levels of TRT; there's no need to use LSMESTIMATE for comparing one level to another.
Paige Miller