Shared Concepts and Topics

Setting Covariate Values

By default, all covariate effects are set equal to their mean values for computation of standard LS-means. The AT option in the LSMEANS statement enables you to set the covariates to whatever values you consider interesting.

If any effect contains two or more covariates, the AT option sets the effect equal to the product of the individual means rather than the mean of the product (as with standard LS-means calculations). The AT MEANS option leaves covariates equal to their mean values (as with standard LS-means) and incorporates this adjustment to crossproducts of covariates.

For example, the following statements specify a model with a classification variable A and two continuous variables, x1 and x2:

class A;
model y = A x1 x2 x1*x2;

The coefficients for the continuous effects with various AT specifications are shown in the following table.

Syntax x1 x2 x1*x2
lsmeans A; x 1 overbar x 2 overbar ModifyingAbove x 1 x 2 With bar
lsmeans A / at means; x 1 overbar x 2 overbar x 1 overbar dot x 2 overbar
lsmeans A / at x1=1.2; 1.2 x 2 overbar 1.2 dot x 2 overbar
lsmeans A / at (x1 x2)=(1.2 0.3); 1.2 0.3 1.2 dot 0.3

For the first two LSMEANS statements, the A LS-mean coefficient for x1 is x 1 overbar (the mean of x1) and for x2 is x 2 overbar (the mean of x2). However, the coefficient for x1*x2 is ModifyingAbove x 1 x 2 With bar for the first LSMEANS statement, but it is x 1 overbar dot x 2 overbar for the second LSMEANS statement. The third LSMEANS statement sets the coefficient for x1 equal to 1.2 and leaves the coefficient for x2 at x 2 overbar, and the final LSMEANS statement sets these values to 1.2 and 0.3, respectively.

The covariate means used in computing the LS-means are affected by the AT option in the LSMEANS statement as follows:

  • If you use a WEIGHT statement:

    • If you do not specify the AT option, unweighted covariate means are used for the covariate coefficients.

    • If you specify the AT option, weighted covariate means are used for the covariate coefficients for which no explicit AT values are specified (thus for all the covariate means if you specify AT MEANS).

  • If any observations have missing dependent variable values:

    • If you do not specify the AT option, these observations are not included in computing the covariate means.

    • If you specify the AT option, these observations are included unless they form a missing cell (a combination of CLASS variables all of whose responses are missing).

These conditions are summarized in Table 24. You can use the E option in conjunction with the AT option to verify that the modified LS-means coefficients are the ones you want.

Table 24: Treatment of Covariate Means with and without the AT Option

Without AT With AT
WEIGHT statement Weights not used Weights used
Observations with missing dependent variable values Observations not included Observations included


The AT option is disabled if you specify the BYLEVEL option, in which case the coefficients for the covariates are set equal to their means within each level of the LS-mean effect in question.

Last updated: December 09, 2022