Syntax: LSMESTIMATE Statement 
In contrast to a multirow estimate in the ESTIMATE statement, you specify only a single effect in the LSMESTIMATE statement. The row labels are optional and follow the modeleffect specification. For example, the following statements fit a splitsplitplot design and compare the average of the third and fourth LSmean of the wholeplot factor A to the first LSmean of the factor:
proc glimmix; class a b block; model y = a b a*b / s; random int a / sub=block; lsmestimate A 'a1 vs avg(a3,a4)' 2 0 1 1 divisor=2; run;
The order in which coefficients are assigned to the least squares means corresponds to the order in which they are displayed in the "Least Squares Means" table. You can use the ELSM option to see how coefficients are matched to levels of the fixed effect.
The optional divisor=n specification enables you to assign a separate divisor to each row of the LSMESTIMATE. You can also assign divisor values through the DIVISOR= option. See the description of the DIVISOR= option that follows for the interaction between the two ways of specifying divisors.
Table 19.24 summarizes important options in the LSMESTIMATE statement. All LSMESTIMATE options are subsequently discussed in alphabetical order.
Option 
Description 

Construction and Computation of LSMeans 

Modifies covariate values in computing LSmeans 

Computes separate margins 

Specifies a list of values to divide the coefficients 

Specifies the weighting scheme for LSmeans computation as determined by a data set 

Tunes estimability checking 

Degrees of Freedom and pvalues 

Determines the method for multiple comparison adjustment of LSmeans differences 

Determines the confidence level () 

Performs onesided, lowertailed inference 

Adjusts multiple comparison pvalues further in a stepdown fashion 

Specifies values under the null hypothesis for tests 

Performs onesided, uppertailed inference 

Statistical Output 

Constructs confidence limits for means and mean differences 

Displays the correlation matrix of LSmeans 

Displays the covariance matrix of LSmeans 

Prints the matrix 

Prints the matrix 

Produces a joint or chisquare test for the LSmeans and LSmeans differences 

Requests ODS statistical graphics of means and mean comparisons 

Specifies the seed for computations that depend on random numbers 

Generalized Linear Modeling 

Specifies how to construct estimable functions with multinomial data 

Exponentiates and displays LSmeans estimates 

Computes and displays estimates and standard errors of LSmeans (but not differences) on the inverse linked scale 
You can specify the following options in the LSMESTIMATE statement after a slash (/):
specifies how denominator degrees of freedom are determined when pvalues and confidence limits are adjusted for multiple comparisons with the ADJUST= option. When you do not specify the ADJDFE= option or when you specify ADJDFE=SOURCE, the denominator degrees of freedom for multiplicityadjusted results are the denominator degrees of freedom for the LSmean effect in the "Type III Tests of Fixed Effects" table.
The ADJDFE=ROW setting is useful if you want multiplicity adjustments to take into account that denominator degrees of freedom are not constant across estimates. For example, this can be the case when the denominator degrees of freedom are computed by the Satterthwaite or KenwardRoger method (Kenward and Roger 1997) in a mixed model.
The ADJDFE= option is not supported by the procedures that perform chisquarebased inference (GENMOD, LOGISTIC, PHREG and SURVEYLOGISTIC).
requests a multiple comparison adjustment for the pvalues and confidence limits for the LSmean estimates. The adjusted quantities are produced in addition to the unadjusted pvalues and confidence limits. Adjusted confidence limits are produced if the CL or ALPHA= option is in effect. For a description of the adjustments, see Chapter 41, The GLM Procedure, and Chapter 60, The MULTTEST Procedure, in addition to the documentation for the ADJUST= option in the LSMEANS statement.
Not all adjustment methods of the LSMEANS statement are available for the LSMESTIMATE statement. Multiplicity adjustments in the LSMEANS statement are designed specifically for differences of least squares means.
If you specify the STEPDOWN option, the pvalues are further adjusted in a stepdown fashion.
requests that a t type confidence interval be constructed for each of the LSmeans with confidence level . The value of number must be between 0 and 1; the default is 0.05.
modifies the values of the covariates used in computing LSmeans. See the AT option in the LSMEANS statement for details.
requests that the procedure compute separate margins for each level of the LSMEANS effect.
The standard LSmeans have equal coefficients across classification effects. The BYLEVEL option changes these coefficients to be proportional to the observed margins. This adjustment is reasonable when you want your inferences to apply to a population that is not necessarily balanced but has the margins observed in the input data set. In this case, the resulting LSmeans are actually equal to raw means for fixedeffects models and certain balanced randomeffects models, but their estimated standard errors account for the covariance structure that you have specified. If a WEIGHT statement is specified, the procedure uses weighted margins to construct the LSmeans coefficients.
If the AT option is specified, the BYLEVEL option disables it.
specifies how to construct estimates and multiplicity corrections for models with multinomial data (ordinal or nominal). This option is also important for constructing sets of estimable functions for F tests with the JOINT option.
computes the estimable functions for every nonredundant category and treats them as a set. For example, a threerow LSMESTIMATE statement in a model with three response categories leads to six estimable functions.
computes the estimable functions for every nonredundant category in turn. For example, a threerow LSMESTIMATE statement in a model with three response categories leads to two sets of three estimable functions.
computes the estimable functions only for the list of values given. The list must consist of formatted values of the response categories.
For further details about using the CATEGORY= option in models for multinomial data, see the documentation for the CATEGORY= option in the ESTIMATE statement.
The CATEGORY= option is supported only by the procedures that support generalized linear modeling (GENMOD, LOGISTIC, and SURVEYLOGISTIC) and by PROC PLM when it is used to perform statistical analyses on item stores that were created by these procedures.
requests that chisquare tests be performed in addition to F tests, when you request an F test with the JOINT option. This option has no effect in procedures that produce chisquare statistics by default.
requests that t type confidence limits be constructed for each of the LSmeans. The confidence level is 0.95 by default; this can be changed with the ALPHA= option. If you specify an ADJUST= option, then the confidence limits are adjusted for multiplicity. But if you also specify STEPDOWN, then only pvalues are stepdown adjusted, not the confidence limits.
displays the estimated correlation matrix of the linear combination of the least squares means.
displays the estimated covariance matrix of the linear combination of the least squares means.
specifies the degrees of freedom for the tests and confidence limits. The option is not supported by the procedures that perform chisquarebased inference (GENMOD, LOGISTIC, PHREG, and SURVEYLOGISTIC).
specifies a list of values by which to divide the coefficients so that fractional coefficients can be entered as integer numerators. If you do not specify valuelist, a default value of 1.0 is assumed. Missing values in the valuelist are converted to 1.0.
If the number of elements in valuelist exceeds the number of rows of the estimate, the extra values are ignored. If the number of elements in valuelist is less than the number of rows of the estimate, the last value in valuelist is carried forward.
If you specify a rowspecific divisor as part of the specification of the estimate row, this value multiplies the corresponding value in the valuelist. For example, the following statement divides the coefficients in the first row by 8, and the coefficients in the third and fourth row by 3:
lsmestimate A 'One vs. two' 8 8 divisor=2, 'One vs. three' 1 0 1 , 'One vs. four' 3 0 0 3 , 'One vs. five' 3 0 0 0 3 / divisor=4,.,3;
Coefficients in the second row are not altered.
requests that the coefficients of the estimable function be displayed. These are the coefficients that apply to the fixedeffect parameter estimates. The E option displays the coefficients that you would need to enter in an equivalent ESTIMATE statement.
requests that the matrix coefficients be displayed. These are the coefficients that apply to the LSmeans. This option is useful to ensure that you assigned the coefficients correctly to the LSmeans.
requests exponentiation of the least squares means estimate. When you model data with the logit link function and the estimate represents a log odds ratio, the EXP option produces an odds ratio. If you specify the CL or ALPHA= option, the (adjusted) confidence limits for the estimate are also exponentiated.
The EXP option is supported only by PROC PHREG, PROC SURVEYPHREG, the procedures that support generalized linear modeling (GENMOD, LOGISTIC, and SURVEYLOGISTIC), and by PROC PLM when it is used to perform statistical analyses on item stores that were created by these procedures.
requests that the estimate and its standard error also be reported on the scale of the mean (the inverse linked scale). The computation of the inverse linked estimate depends on the estimation mode. For example, if the analysis is based on a posterior sample when a BAYES statement is present, the inversely linked estimate is the average of the inversely linked values across the sample of posterior parameter estimates. If the analysis is not based on a sample of parameter estimates, the procedure computes the value on the mean scale by applying the inverse link to the estimate.
The interpretation of the inversely linked quantity depends on the coefficients that are specified in your LSMESTIMATE statement and the link function. For example, in a model for binary data with logit link the following LSMESTIMATE statement computes
where and are the least squares means that are associated with the first two levels of the classification effect A:
proc logistic; class A / param=glm; model y = A / dist=binary link=logit; lsmestimate A 1 1 / ilink; run;
The quantity is not the difference of the probabilities associated with the two levels,
The standard error of the inversely linked estimate is based on the delta method. If you also specify the CL or ALPHA= option, the procedure computes confidence intervals for the inversely linked estimate. These intervals are obtained by applying the inverse link to the confidence intervals on the linked scale.
The ILINK option is supported only by the procedures that support generalized linear modeling (GENMOD, LOGISTIC, and SURVEYLOGISTIC) and by PROC PLM when it is used to perform statistical analyses on item stores that were created by these procedures.
requests that a joint F or chisquare test be produced for the rows of the estimate. For more information about the simulationbased pvalue calculation, see the section Joint Hypothesis Tests with Complex Alternatives, the ChiBarSquare Statistic. You can specify the following jointtestoptions in parentheses:
specifies the accuracy radius for determining the necessary sample size in the simulationbased approach of Silvapulle and Sen (2004) for tests with order restrictions. The value of must be strictly between 0 and 1; the default value is 0.005.
specifies the accuracy confidence level for determining the necessary sample size in the simulationbased approach of Silvapulle and Sen (2004) for F tests with order restrictions. The value of must be strictly between 0 and 1; the default value is 0.01.
assigns an identifying label to the joint test. If you do not specify a label, the first nondefault label for the ESTIMATE rows is used to label the joint test.
performs only the joint test and suppresses other results from the ESTIMATE statement. This option is useful for emulating the CONTRAST statement that is available in other procedures.
specifies the number of samples for the simulationbased method of Silvapulle and Sen (2004). If n is not specified, it is constructed from the values of the ALPHA=, the ACC=, and the EPS= options. With the default values for , , and (0.005, 0.01, and 0.05, respectively), NSAMP=12,604 by default.
adds a chisquare test if the procedure produces an F test by default.
specifies boundary values for the estimable linear function. The null value of the hypothesis is always zero. If you specify a positive boundary value , the hypotheses are , with the added constraint that . The same is true for negative boundary values. The alternative hypothesis is then subject to the constraint . If you specify a missing value, the hypothesis is assumed to be twosided. The BOUNDS option enables you to specify sets of one and twosided joint hypotheses. If all values in valuelist are set to missing, the procedure performs a simulationbased pvalue calculation for a twosided test.
requests that the pvalue for the t test be based only on values that are less than the test statistic. A twotailed test is the default. A lowertailed confidence limit is also produced if you specify the CL or ALPHA= option.
Note that for ADJUST=SCHEFFE the onesided adjusted confidence intervals and onesided adjusted pvalues are the same as the corresponding twosided statistics, because this adjustment is based on only the right tail of the F distribution.
If you request an F test with the JOINT option, then a onesided lefttailed order restriction is applied to all estimable functions, and the corresponding chibarsquare statistic of Silvapulle and Sen (2004) is computed in addition to the twosided, standard, F or chisquare statistic. See the JOINT option for how to control the computation of the simulationbased chibarsquare statistic.
specifies a potentially different weighting scheme for the computation of LSmeans coefficients. The standard LSmeans have equal coefficients across classification effects; however, the OM option changes these coefficients to be proportional to those found in the OMdataset. This adjustment is reasonable when you want your inferences to apply to a population that is not necessarily balanced but has the margins observed in OMdataset. See the OBSMARGINS option in the LSMEANS statement for further details.
produces ODS statistical graphics of the distribution of estimable functions if the procedure performs the analysis in a samplingbased mode. For example, this is the case when procedures support a BAYES statement and perform a Bayesian analysis. The estimable functions are then computed for each of the posterior parameter estimates, and the "Least Squares Means Estimates" table reports simple descriptive statistics for the evaluated functions. In this situation, the PLOTS= option enables you to visualize the distribution of the estimable function. The following plotoptions are available:
produces all possible plots with their default settings.
produces box plots of the distribution of the estimable function across the posterior sample. A separate box plot is generated for each estimable function and all box plots appear on a single graph by default. You can affect the appearance of the box plot graph with the following options:
specifies the orientation of the boxes. The default is vertical orientation of the box plots.
specifies how to break the series of box plots across multiple panels. If the NPANELPOS option is not specified, or if number equals zero, then all box plots are displayed in a single graph; this is the default. If a negative number is specified, then exactly up to number of box plots are displayed per panel. If number is positive, then the number of boxes per panel is balanced to achieve small variation in the number of box plots per graph.
generates panels of histograms with a kernel density overlaid. A separate plot in each panel contains the results for each estimable function. You can specify the following distplotoptions in parentheses:
controls the display of a horizontal box plot below the histogram. The BOX option is enabled by default.
controls the display of the histogram of the estimable function’s distribution across the posterior sample. The HIST option is enabled by default.
controls the display of a normal density estimate on the graph. The NONORMAL option is enabled by default.
controls the display of a kernel density estimate on the graph. The KERNEL option is enabled by default.
specifies the highest number of rows in a panel. The default is 3.
specifies the highest number of columns in a panel. The default is 3.
unpacks the panel into separate graphics.
does not produce any plots.
specifies the seed for the samplingbased components of the computations for the LSMESTIMATE statement (for example, chibarsquare statistics and simulated pvalues). number specifies an integer that is used to start the pseudorandomnumber generator for the simulation. If you do not specify a seed, or if you specify a value less than or equal to zero, the seed is generated from reading the time of day from the computer clock. Note that there could be multiple LSMESTIMATE statements with SEED= specifications and there could be other statements that can supply a random number seed. Since the procedure has only one random number stream, the initial seed is shown in the SAS log.
tunes the estimability checking as documented for the SINGULAR= option in the ESTIMATE statement.
requests that multiplicity adjustments for the pvalues of estimable functions be further adjusted in a stepdown fashion. Stepdown methods increase the power of multiple testing procedures by taking advantage of the fact that a pvalue is never declared significant unless all smaller pvalues are also declared significant. The STEPDOWN adjustment combined with ADJUST=BON corresponds to the methods of Holm (1979) and "Method 2" of Shaffer (1986); this is the default. Using stepdownadjusted pvalues combined with ADJUST=SIMULATE corresponds to the method of Westfall (1997).
If the ESTIMATE statement is applied with a STEPDOWN option in a mixed model where the degreesoffreedom method is that of Kenward and Roger (1997) or of Satterthwaite, then stepdownadjusted pvalues are produced only if the ADJDFE=ROW option is in effect.
Also, the STEPDOWN option affects only pvalues, not confidence limits. For ADJUST=SIMULATE, the generalized least squares hybrid approach of Westfall (1997) is used to increase Monte Carlo accuracy.
You can specify the following stepdownoptions in parentheses:
specifies the time (in seconds) to be spent computing the maximal logically consistent sequential subsets of equality hypotheses for TYPE=LOGICAL. The default is MAXTIME=60. If the MAXTIME value is exceeded, the adjusted tests are not computed. When this occurs, you can try increasing the MAXTIME value. However, note that there are common multiple comparisons problems for which this computation requires a huge amount of time—for example, all pairwise comparisons between more than 10 groups. In such cases, try to use TYPE=FREE (the default) or TYPE=LOGICAL() for small .
specifies the order in which the stepdown tests are performed. ORDER=PVALUE is the default, with LSmean estimates being declared significant only if all LSmean estimates with smaller (unadjusted) pvalues are significant. If you specify ORDER=ROWS, then significances are evaluated in the order in which they are specified.
specifies that a report on the stepdown adjustment be displayed, including a listing of the sequential subsets (Westfall 1997) and, for ADJUST=SIMULATE, the stepdown simulation results.
specifies how stepdown adjustment are made. If you specify TYPE=LOGICAL, the stepdown adjustments are computed by using maximal logically consistent sequential subsets of equality hypotheses (Shaffer 1986, Westfall 1997). Alternatively, for TYPE=FREE, sequential subsets are computed ignoring logical constraints. The TYPE=FREE results are more conservative than those for TYPE=LOGICAL, but they can be much more efficient to produce for many estimates. For example, it is not feasible to take logical constraints between all pairwise comparisons of more than about 10 groups. For this reason, TYPE=FREE is the default.
However, you can reduce the computational complexity of taking logical constraints into account by limiting the depth of the search tree used to compute them, specifying the optional depth parameter as a number in parentheses after TYPE=LOGICAL. As with TYPE=FREE, results for TYPE=LOGICAL() are conservative relative to the true TYPE=LOGICAL results. But even for TYPE=LOGICAL(), they can be appreciably less conservative than TYPE=FREE, and they are computationally feasible for much larger numbers of estimates. If you do not specify or if , the full search tree is used.
specifies the value under the null hypothesis for testing the estimable functions in the LSMESTIMATE statement. The rules for specifying the valuelist are very similar to those for specifying the divisor list in the DIVISOR= option. If no TESTVALUE= is specified, all tests are performed as . Missing values in the valuelist also are translated to zeros. If you specify fewer values than rows in the LSMESTIMATE statement, the last value in valuelist is carried forward.
The TESTVALUE= option affects only values from individual, joint, and multiplicityadjusted tests. It does not affect confidence intervals.
The TESTVALUE option is not available for the multinomial distribution, and the values are ignored when you perform a samplingbased (Bayesian) analysis.
requests that the pvalue for the t test be based only on values that are greater than the test statistic. A twotailed test is the default. An uppertailed confidence limit is also produced if you specify the CL or ALPHA= option.
Note that for ADJUST=SCHEFFE the onesided adjusted confidence intervals and onesided adjusted pvalues are the same as the corresponding twosided statistics, because this adjustment is based on only the right tail of the F distribution.
If you request a joint test with the JOINT option, then a onesided righttailed order restriction is applied to all estimable functions, and the corresponding chibarsquare statistic of Silvapulle and Sen (2004) is computed in addition to the twosided, standard, F or chisquare statistic. See the JOINT option for how to control the computation of the simulationbased chibarsquare statistic.