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
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.