BookmarkSubscribeRSS Feed
AgaWS
Fluorite | Level 6

Hi guys,

I want to get the mean intake of several food groups after adjusting for a continuous covariate, the total energy intake (TEI). 

I used proc glm to obtain the lsmeans for different sex as in the code below and the output:

 

proc glm data=test;
      class sex;
      model &foodgroup = sex TEI / solution;
      lsmeans sex / stderr pdiff diff cov out=adjmeans;
   run;
   proc print data=adjmeans;
   run;

AgaWS_0-1646249705482.png

Now I want to get the adjusted mean value for the total population and not for the genders seperatly but I couldn't find the right statement.

I would be grateful for any help

 

Thanks a lot! 

 

 

4 REPLIES 4
gcjfernandez
SAS Employee

You can use  the at option with LSMEANS  to specify the value of the covariate.

gcjfernandez_gmail_com_0-1646251454796.png

 

PaigeMiller
Diamond | Level 26

@gcjfernandez can you provide a link to this text that you are showing?

--
Paige Miller
gcjfernandez
SAS Employee

The link for at option in Lsmeans:

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.3/statug/statug_glm_details41.htm#statug.glm.gl...

This will estimate LSmeans of categorical variable levels at a known level of covariate(s)

StatDave
SAS Super FREQ

Two possible ways:

1) mean-center TEI and fit the model omitting SEX. The intercept is the estimated overall mean at the mean of TEI.

proc standard data=test m=0; var TEI; run;
proc glm; model &foodgroup = TEI / solution; run;

2) Use an ESTIMATE statement in your original GLM step - specify the mean TEI and appropriate coefficients for the levels of SEX - probably either 0.5 0.5 to represent a balanced population or the actual observed proportions of the sexes in your data. Assuming a balanced population and mean of TEI is 5.3:

estimate 'adj overall mean' intercept 1 sex .5 .5 TEI 5.3;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 463 views
  • 4 likes
  • 4 in conversation