Using SAS Survey:
How can I get a means table of the data resulting from an ANCOVA in proc surveyreg? I'm trying to find the variable means that result when a regression of two variables is controlled for gender (or age or another variable). I can't seem to build appropriate syntax. Any ideas?
Linda,
Have you specified an LSMEANS statement?
From what you have presented, I assume you have something like:
proc surveyreg data=have;
strata sex;
class sex;
model depvar=sex othervar sex*othervar/solution;
weight weight;
run;
Add the LSMEANS statement that looks something like the following, and it should give you marginal means, adjusted for the covariate 'othervar'. Note that these are predicted marginals for a hypothetical balanced population.
proc surveyreg data=have;
strata sex;
class sex;
model depvar=sex othervar sex*othervar/solution;
weight weight;
lsmeans sex;
run;
There are several options available to the LSMEANS statement that you might want to explore. Also, I specified a model that had different slopes for each sex in the ANCOVA--you may wish to fit a common slopes model which would not include the interaction term.
Good luck.
Steve Denham
I'd think they are provided in one of the ODS tables (see: http://support.sas.com/documentation/cdl/en/odsug/61723/HTML/default/viewer.htm#a002649072.htm )
Note: Surveyreg is in the second section of the page, under the SAS/Stat procs.
I probably shouldn't have posted a response as I have never used the proc. However, that said, wouldn't specifying contrasts provide what you want or, if not, proc surveymeans? Take a look at: http://support.sas.com/rnd/app/papers/survey.pdf
Thank you so much for trying to help me with this. The thing is, I need to tell SAS to provide adjusted means based on the ANCOVA and I can't see how to write that request. If I use the standard surveymeans request, the response is the unadjusted means. I can't understand how to tell SAS to provide adjusted means in SAS Survey.
Linda,
Have you specified an LSMEANS statement?
From what you have presented, I assume you have something like:
proc surveyreg data=have;
strata sex;
class sex;
model depvar=sex othervar sex*othervar/solution;
weight weight;
run;
Add the LSMEANS statement that looks something like the following, and it should give you marginal means, adjusted for the covariate 'othervar'. Note that these are predicted marginals for a hypothetical balanced population.
proc surveyreg data=have;
strata sex;
class sex;
model depvar=sex othervar sex*othervar/solution;
weight weight;
lsmeans sex;
run;
There are several options available to the LSMEANS statement that you might want to explore. Also, I specified a model that had different slopes for each sex in the ANCOVA--you may wish to fit a common slopes model which would not include the interaction term.
Good luck.
Steve Denham
This works perfectly! Thanks, Steve!!
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!
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.