BookmarkSubscribeRSS Feed
MaryA_Marion
Lapis Lazuli | Level 10

This has to do with proc mixed difference of LSMeans and LSMeans tables.

 

Here is my code:

%let data = sashelp.cars;
%let depvar = mpg_city;
%let indvar = origin;
ods trace on;
proc mixed data=&data method=type3;
class &indvar;
model &depvar=&indvar / solution;
lsmeans &indvar / pdiff alpha=.05 cl; 
lsmeans &indvar / pdiff adjust=BON alpha=0.05 cl;
lsmeans &indvar / pdiff adjust=DUNNETT alpha=0.05 cl;
lsmeans &indvar / pdiff adjust=GT2 alpha=.05 cl; *Sidaks SMM;
lsmeans &indvar / pdiff adjust=SCHEFFE alpha=0.05 cl;
lsmeans &indvar / diff adjust=SIDAK alpha=.05 cl;
lsmeans &indvar / pdiff adjust=simulate(seed=4938371 report) alpha=.05 cl;
lsmeans &indvar / pdiff adjust=TUKEY alpha=0.05 cl;
run; quit; title; 
Every run of lsmeans causes LS means to be added to Least Squares Means Table.
My attempt seen below is resulting in Differences of LSmeans table not being output.
ods select ModelInfo ClassLevels Dimensions Nobs Type3 CovParms FitStatistics SolutionF Tests3 LSMeans where = (_path_ ? 'Step1');
Can you help? Thank you.

 

1 REPLY 1
FreelanceReinh
Jade | Level 19

Hello @MaryA_Marion,

 

You can create the "Differences of Least Squares Means" table in a separate PROC MIXED step. With suitable preparations, partly depending on your ODS destination, the output will look (almost) like it was created by a single PROC MIXED step.

 

Example with ODS HTML:

%let data = sashelp.cars;
%let depvar = mpg_city;
%let indvar = origin;

ods html file='C:\Temp\mixed_model.html' options(pagebreak='no');
ods select ModelInfo ClassLevels Dimensions Nobs Type3 CovParms FitStatistics 
           SolutionF Tests3 LSMeans;

proc mixed data=&data method=type3;
class &indvar;
model &depvar=&indvar / solution;
lsmeans &indvar / alpha=.05 cl; 
run;

title;
ods noproctitle;
ods select Diffs;

proc mixed data=&data;
class &indvar;
model &depvar=&indvar;
lsmeans &indvar / pdiff alpha=.05 cl; 
lsmeans &indvar / pdiff adjust=BON alpha=0.05 cl;
lsmeans &indvar / pdiff adjust=DUNNETT alpha=0.05 cl;
lsmeans &indvar / pdiff adjust=GT2 alpha=.05 cl; *Sidaks SMM;
lsmeans &indvar / pdiff adjust=SCHEFFE alpha=0.05 cl;
lsmeans &indvar / pdiff adjust=SIDAK alpha=.05 cl;
lsmeans &indvar / pdiff adjust=simulate(seed=4938371 report) alpha=.05 cl;
lsmeans &indvar / pdiff adjust=TUKEY alpha=0.05 cl;
run;

ods html close;

title 'The SAS System';
ods proctitle;

 

For LISTING output you may want to add

options nonumber nodate formdlim=' ';

before the second PROC MIXED step and

options number date formdlim='';

after it (if these are the option settings that you want to restore).

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 369 views
  • 0 likes
  • 2 in conversation