![]() | ![]() | ![]() | ![]() | ![]() |
To compute or compare LS-means for an effect that is related to a covariate, you can use the AT option in the LSMEANS statement, available in the GLM, MIXED, GENMOD, and many other modeling procedures. By default, all continuous covariates are set at their means when computing LSMEANS. For details, see "Construction of Least Squares Means" in the description of the LSMEANS statement. You can modify the values used for continuous covariates with the AT option. To avoid extrapolating outside the range of the data, the values specified in the AT option should generally be within the observed range.
Consider the following data set.
data test;
input trt $ x y;
datalines;
A 10.3928 20.469
A 1.0304 2.242
A 4.0038 10.384
A 19.6831 38.936
A 12.2837 25.062
B 25.8380 80.616
B 5.6191 20.881
B 25.3164 77.252
B 10.0879 31.314
B 27.0792 85.066
C 27.6587 113.275
C 15.8211 67.454
C 6.9228 31.015
C 11.5046 49.103
C 10.2614 44.924
;
The following LSMEANS statements compute LS-means for each level of TRT at x=10, the mean of X which is the default if AT is omitted, and x=20. Note that these values are within the observed range of X in the data. The PDIFF option produces multiple comparisons among the TRT levels at these covariate values.
proc mixed data=test;
class trt;
model y = trt x*trt / noint;
lsmeans trt / at x=10 pdiff;
lsmeans trt / at means pdiff;
lsmeans trt / at x=20 pdiff;
run;
Following are the results of the LSMEANS statements.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Product Family | Product | System | SAS Release | |
| Reported | Fixed* | |||
| SAS System | SAS/STAT | All | n/a | |
data test;
input trt $ x y;
datalines;
A 10.3928 20.469
A 1.0304 2.242
A 4.0038 10.384
A 19.6831 38.936
A 12.2837 25.062
B 25.8380 80.616
B 5.6191 20.881
B 25.3164 77.252
B 10.0879 31.314
B 27.0792 85.066
C 27.6587 113.275
C 15.8211 67.454
C 6.9228 31.015
C 11.5046 49.103
C 10.2614 44.924
;
proc mixed data=test;
class trt;
model y = trt x*trt / noint;
lsmeans trt / at x=10 pdiff;
lsmeans trt / at means pdiff; /* LSMEANS at mean, the default */
lsmeans trt / at x=20 pdiff;
run;
Least Squares Means
Standard
Effect trt x Estimate Error DF t Value Pr > |t|
trt A 10.00 20.4177 0.5323 9 38.36 <.0001
trt B 10.00 32.6617 0.7394 9 44.18 <.0001
trt C 10.00 43.5815 0.6232 9 69.94 <.0001
trt A 14.23 28.5322 0.6559 9 43.50 <.0001
trt B 14.23 45.3622 0.5939 9 76.37 <.0001
trt C 14.23 60.3608 0.5308 9 113.71 <.0001
trt A 20.00 39.5850 1.0046 9 39.40 <.0001
trt B 20.00 62.6614 0.5354 9 117.05 <.0001
trt C 20.00 83.2157 0.6707 9 124.07 <.0001
Differences of Least Squares Means
Standard
Effect trt _trt x Estimate Error DF t Value Pr > |t|
trt A B 10.00 -12.2440 0.9110 9 -13.44 <.0001
trt A C 10.00 -23.1638 0.8196 9 -28.26 <.0001
trt B C 10.00 -10.9198 0.9669 9 -11.29 <.0001
trt A B 14.23 -16.8299 0.8848 9 -19.02 <.0001
trt A C 14.23 -31.8285 0.8438 9 -37.72 <.0001
trt B C 14.23 -14.9986 0.7966 9 -18.83 <.0001
trt A B 20.00 -23.0764 1.1383 9 -20.27 <.0001
trt A C 20.00 -43.6307 1.2079 9 -36.12 <.0001
trt B C 20.00 -20.5543 0.8582 9 -23.95 <.0001
| Type: | Usage Note |
| Priority: | low |
| Topic: | Analytics ==> Longitudinal Analysis SAS Reference ==> Procedures ==> GLM SAS Reference ==> Procedures ==> GEE SAS Reference ==> Procedures ==> GENMOD SAS Reference ==> Procedures ==> GLIMMIX SAS Reference ==> Procedures ==> LIFEREG SAS Reference ==> Procedures ==> LOGISTIC SAS Reference ==> Procedures ==> MIXED SAS Reference ==> Procedures ==> ORTHOREG SAS Reference ==> Procedures ==> PHREG SAS Reference ==> Procedures ==> PLM SAS Reference ==> Procedures ==> PROBIT SAS Reference ==> Procedures ==> SURVEYLOGISTIC SAS Reference ==> Procedures ==> SURVEYPHREG SAS Reference ==> Procedures ==> SURVEYREG |
| Date Modified: | 2019-04-19 09:46:51 |
| Date Created: | 2002-12-16 10:56:40 |




