|
Chapter Contents |
Previous |
Next |
| The SURVEYMEANS Procedure |
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
Output 13.3.2: Analyze Incomplete Ice Cream Data Treating Respondents as a Domain
| ||||||||||||||||||||||||||
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 2000 by SAS Institute Inc., Cary, NC, USA. All rights reserved.