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;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.