Hi,
I'm running a model in proc GLM.
That looks something like this:
PROC GLM data=a; by subject; class activity; model cont_var=activity; lSMEANS activity / adjust = Tukey out=b; run; quit;
The activities are a. (reference), b., c., d.
The current code only outputs cont_var LSMEANS and the p values for the difference from a.
How would I be able to output the LSMEANS difference from a?
Hello,
Is this what you are after?
*ods trace on;
*ods output Diff=work.Difference_Matrix;
ods output LSMeans=work.LSMeans;
PROC GLM data=sashelp.class;
*by subject;
class age;
model height=age;
LSMEANS age / adjust = Tukey out=b;
run;
quit;
data work.LSMeans_DIFF;
set work.LSMeans;
retain ref .;
if _N_=1 then do; ref=LSMean; end;
Diff = LSMean - ref;
run;
/* end of program */
Koen
Hello,
Is this what you are after?
*ods trace on;
*ods output Diff=work.Difference_Matrix;
ods output LSMeans=work.LSMeans;
PROC GLM data=sashelp.class;
*by subject;
class age;
model height=age;
LSMEANS age / adjust = Tukey out=b;
run;
quit;
data work.LSMeans_DIFF;
set work.LSMeans;
retain ref .;
if _N_=1 then do; ref=LSMean; end;
Diff = LSMean - ref;
run;
/* end of program */
Koen
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.