BookmarkSubscribeRSS Feed

Examples of writing CONTRAST and ESTIMATE statements

Started ‎12-06-2022 by
Modified ‎12-07-2022 by
Views 324

The article described below can be seen in this SAS Note.


The CONTRAST and ESTIMATE statements allow for estimation and testing of any linear combination of model parameters. However, a common subclass of interest involves comparison of means and most of the examples below are from this class. While examples in this class provide good examples of the above process for determining coefficients for CONTRAST and ESTIMATE statements, there are other statements available that perform means comparisons more easily. These statements include the LSMEANS, LSMESTIMATE, and SLICE statements that are available in many procedures. The ODDSRATIO statement in PROC LOGISTIC and the similar HAZARDRATIO statement in PROC PHREG are also available. While the main purpose of this note is to illustrate how to write proper CONTRAST and ESTIMATE statements, these additional statements are also presented when they can provide equivalent analyses.


This note focuses on assessing the effects of categorical (CLASS) variables in models containing interactions. All of the statements mentioned above can be used for this purpose. To assess the effects of continuous variables involved in interactions or constructed effects such as splines, see this note. Note that some functions, like ratios, are nonlinear combinations and cannot generally be obtained with these statements. To estimate, test, or compare nonlinear combinations of parameters, see the NLEST and NLMeans macros.

Version history
Last update:
‎12-07-2022 10:06 AM
Updated by:



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags