This might be a really stupid question. Even though I am a long time SAS user, I am not sure if I am missing something. I am replicating slides that were done in SPSS in SAS. In SPSS it seems I can get marginal means for levels of my categorical values even though there is no interaction specified in the model. So, my model has married (single Married) and sex (M or F) and I can get a table of means for single Male, Married male, single female, married female using a by statement in SPSS. I see no way to get these means in SAS without specifying an interaction in the model. Am I missing something basic? Thank you.
You might show the code you are using so we can see what potential code interactions there may be.
Sorry,
This is my SAS code, but what I want is lsmeans for married by sex at age=0 but without putting the interaction in the model. And so far, that does not seem possible.
PROC GLM DATA=AGE;
CLASS MARRIED SEX;
MODEL JOB_PRESTIGE = MARRIED SEX AGE/SS3 INT;
LSMEANS MARRIED/ AT (age) = (0);
RUN;
Thank you
You can use the ESTIMATE statement, for example:
proc glm data=sashelp.baseball;
class league division ;
model salary = league division nhits / solution;
estimate "American East at nhits=50" intercept 1 league 1 0 division 1 0 nhits 50;
estimate "American West at nhits=50" intercept 1 league 1 0 division 0 1 nhits 50;
estimate "National East at nhits=50" intercept 1 league 0 1 division 1 0 nhits 50;
estimate "National West at nhits=50" intercept 1 league 0 1 division 0 1 nhits 50;
run;
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 16. 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.