Beginning in SAS/STAT 14.2 in SAS 9.4 TS1M4, you can use the DIFF option in the DOMAIN statement to compare the means of continuous variables. Refer to the SAS OnlineDoc® documentation for details and additional options.
In earlier releases, you can use PROC SURVEYREG to compare means instead.
The following DATA step creates a data set named SAMPLE, representing a stratified and clustered sample design. Measurements are obtained on three variables, X1, X2 and X3, and there is a domain variable D with two levels.
Here is the partial printout of the data set:
PROC SURVEYMEANS can compute the overall and domain means and their standard errors as follows.
In order to use PROC SURVEYREG for variable means comparisons, first reshape the data so that it is arranged for an ANOVA. That is, so that all the measurements are in a single variable and there is a class indicator variable. This DATA step creates the analysis variable MEASUREMENT containing the X1, X2 and X3 values and the class variable GROUP.
Here is the partial printout of the reshaped data.
To set up an equivalent analysis in PROC SURVEYREG, specify the same design and weight statements that you had in PROC SURVEYMEANS. The model response variable is MEASUREMENT, the set of all analysis variable values from the reshaped data, and the independent class variable is GROUP, the ID variable also created in the reshaped data. It is convenient to specify a no-intercept model with the NOINT option, so that the parameter estimates are equal to the analysis variable means. The following CONTRAST statement in PROC SURVEYREG compares the means of X1, X2 and X3.
Note that the VADJUST= option is specified. VADJUST=DF by default in PROC SURVEYREG, which uses the degrees of freedom adjustment factor (n-1)/(n-p) in the G matrix. This results in different variance estimates in PROC SURVEYREG than those obtained in PROC SURVEYMEANS. By using VADJUST=NONE, the same variance estimates can be obtained in PROC SURVEYREG. The VADJUST= option was added in SAS 9.1. Prior to SAS 9.1, you would have to use the %SMSUB macro to compute contrasts for variables or domain levels.
You can compare the domain means using the original data set. This code compares the mean of X1 between the two domains.
Additional help on writing contrasts is presented in Examples of Writing CONTRAST and ESTIMATE Statements.
Product Family | Product | System | SAS Release | |
Reported | Fixed* | |||
SAS System | SAS/STAT | 64-bit Enabled Solaris | ||
64-bit Enabled HP-UX | ||||
64-bit Enabled AIX | ||||
Windows Millennium Edition (Me) | ||||
Windows Vista | ||||
Microsoft Windows XP Professional | ||||
Microsoft Windows Server 2003 Standard Edition | ||||
Microsoft Windows Server 2003 Enterprise Edition | ||||
Microsoft Windows Server 2003 Datacenter Edition | ||||
Microsoft Windows NT Workstation | ||||
Microsoft Windows 2000 Professional | ||||
Microsoft Windows 2000 Server | ||||
Microsoft Windows 2000 Datacenter Server | ||||
Microsoft Windows 2000 Advanced Server | ||||
OS/2 | ||||
Microsoft Windows 95/98 | ||||
Microsoft® Windows® for x64 | ||||
Microsoft Windows XP 64-bit Edition | ||||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | ||||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | ||||
Microsoft® Windows® for 64-Bit Itanium-based Systems | ||||
OpenVMS VAX | ||||
z/OS | ||||
ABI+ for Intel Architecture | ||||
AIX | ||||
HP-UX | ||||
HP-UX IPF | ||||
IRIX | ||||
Linux | ||||
Linux for x64 | ||||
Linux on Itanium | ||||
OpenVMS Alpha | ||||
OpenVMS on HP Integrity | ||||
Solaris | ||||
Solaris for x64 | ||||
Tru64 UNIX |
Type: | Usage Note |
Priority: | |
Topic: | Analytics ==> Analysis of Variance Analytics ==> Regression Analytics ==> Survey Sampling and Analysis SAS Reference ==> Procedures ==> SURVEYMEANS SAS Reference ==> Procedures ==> SURVEYREG |
Date Modified: | 2017-04-07 10:55:04 |
Date Created: | 2009-01-27 12:30:44 |