BookmarkSubscribeRSS Feed
ahschnell
Fluorite | Level 6

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.

3 REPLIES 3
ballardw
Super User

You might show the code you are using so we can see what potential code interactions there may be.

ahschnell
Fluorite | Level 6

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

sld
Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 3 replies
  • 1372 views
  • 0 likes
  • 3 in conversation