Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The SURVEYMEANS Procedure

Example 13.3: Analyze Survey Data with Missing Values

As described in the section "Missing Values", the SURVEYMEANS procedure excludes an observation from the analysis if it has a missing value for the analysis variable or a nonpositive value for the WEIGHT variable.

However, if there is evidence indicating that the nonrespondents are different from the respondents for your study, you can use the DOMAIN statement to compute descriptive statistics "among respondents" from your survey data without imputation for nonrespondents.

Consider the ice cream example in the section "Stratified Sampling". Suppose that some of the students failed to provide the amounts spent on ice cream, as shown in the following data set IceCream:

   data IceCream;
      input Grade Spending @@; datalines; 
   7 7  7  7  8  .  9 10  7  .  7 10  7  3  8 20  8 19  7 2
   7 .  9 15  8 16  7  6  7  6  7  6  9 15  8 17  8 14  9 .
   9 8  9  7  7  3  7 12  7  4  9 14  8 18  9  9  7  2  7 1
   7 4  7 11  9  8  8  .  8 13  7  .  9  .  9 11  7  2  7 9
   ;
   data StudentTotals;
      input Grade _total_; datalines;
   7 1824
   8 1025
   9 1151
   ;

Considering the possibility that those students who didn't respond spend differently than those students who did respond, you can create an indicator variable to identify the respondents and non-respondents using the following SAS DATA step:

   data IceCream; 
      set IceCream; 
      if Spending=. then Indicator='Nonrespondent';
      else do;
         Indicator='Respondent';
         if (Spending < 10) then Group='less';
            else Group='more';
         end; 
      if Grade=7 then Prob=20/1824;
      if Grade=8 then Prob=9/1025;
      if Grade=9 then Prob=11/1151;
      Weight=1/Prob;

Variable Indicator identifies a student in the data set as either a respondent or a nonrespondent. Variable Group specifies whether a student spent more than $10 among the respondents.

The following SAS statements analyze the incomplete ice cream data:

   title1 'Analysis of Ice Cream Spending';
   proc surveymeans data=IceCream total=StudentTotals mean sum;
      stratum Grade / list; 
      var Spending Group;
      weight Weight;
      domain Indicator;
   run;

Output 13.3.1: Analyze Incomplete Ice Cream Data Excluding Observations with Missing Values
 
Analysis of Ice Cream Spending

The SURVEYMEANS Procedure

Data Summary
Number of Strata 3
Number of Observations 40
Sum of Weights 4000
 
Statistics
Variable Mean Std Error of Mean Sum Std Dev
Spending
Group=less
Group=more
9.770542
0.515404
0.484596
0.541381
0.067092
0.067092
32139
1695.345455
1594.004040
1780.792065
220.690305
220.690305

Output 13.3.1 shows the mean and total estimates excluding those students who failed to provide the spending amount on ice cream.

Output 13.3.2: Analyze Incomplete Ice Cream Data Treating Respondents as a Domain
 
Analysis of Ice Cream Spending

The SURVEYMEANS Procedure

Domain Analysis: Indicator
Indicator Variable Mean Std Error of Mean Sum Std Dev
Nonrespondent Spending
Group=less
Group=more
.
.
.
.
.
.
.
.
.
.
.
.
Respondent Spending
Group=less
Group=more
9.770542
0.515404
0.484596
0.652347
0.067257
0.067257
32139
1695.345455
1594.004040
3515.126876
221.232029
221.232029

Output 13.3.2 shows the mean and total estimates treating respondents as a domain in the student population. Compared to the estimates in Output 13.3.1, the point estimates are the same, but the variance estimates are slightly higher.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 2000 by SAS Institute Inc., Cary, NC, USA. All rights reserved.