In this example, you will be looking at the proportion of examined persons 20 years and older with measured high blood pressure, by sex, age, and race-ethnicity.
In order to subset the data in SAS Survey Procedures, you will need to create a variable for the population of interest. In this example, the sel variable is set to 1 if the sample person is 20 years or older, and 2 if the sample person is younger than 20 years. Then this variable is used in the domain statement to specify the population of interest (those 20 years and older).
if ridageyr GE 20 then sel = 1;
else sel = 2;
In SAS Survey Procedures, persons with high blood pressure, as defined above, are assigned a value of 100, and persons without high blood pressure are assigned a value of 0. The weighted mean of sample persons with a value equal to 100 (which will be expressed as a percent) is an estimate of the prevalence of high blood pressure in the U.S.
These programs use variable formats listed in the Tutorial Formats page. You may need to format the variables in your dataset the same way to reproduce results presented in the tutorial.
|ods trace on ;||
Use the ods statement to provide printer-friendly output.
|data=analysis_Data nobs mean stderr||
Use the proc surveymeans procedure to obtain number of observations, mean, and standard error.
Use the stratum statement to define the strata variable (sdmvstra).
Use the cluster statement to define the PSU variable (sdmvpsu).
|class riagendr age race;||
Use the class statement to specify the discrete variables used to form the subpopulations of interest. In this example, the subpopulation of interest are gender (riagendr), age (age), and race/ethnicity (race).
domain sel sel*riagendr*age*race;
|Use the domain statement to specify the table layout to form the subpopulations of interest. This example uses age greater than or equal to 20 (sel) by gender (riagendr) by age (age) and by race/ethnicity (race).|
Use the var statement to name the variable(s) to be analyzed. In this example, the high blood pressure variable (hbpx) is used. If the sample person has high blood pressure, then the value equals 100. If the sample person does not have high blood pressure, then the value equals 0.
The SAS Survey procedure, proc surveymeans, is only able to use the variable coded as 100 and 0.
Use the weight statement to account for the unequal probability of sampling and non-response. In this example, the MEC weight for 4 years of data (wtmec4yr) is used.
Use the ods statement to output the dataset of estimates from the subdomains listed on the domain statement above. This set of commands will output two datasets for each subdomain specified in the domain statement above (domain for sel; domain1 for sel*riagendr*age*race).
if sel='Age ge 20'; ;
Use the data statement to name the temporary SAS dataset (all) append the two datasets, created in the previous step, if age is greater than or equal to 20 (sel).
noobs data =all split = '/' ;
var riagendr age race N mean stderr ;
format n 5.0 mean 4.4 stderr 4.2 ;
label N = 'Sample' / 'size'
stderr='Standard' / 'error' / 'of the' / 'percent';
title1 'Percent of adults 20 years and older with high blood pressure, 1999-2002' ;
Use the print statement to print the number of observations, the mean, and standard error of the mean in a printer- friendly format.
The percents in the output are the proportions of sample persons with high blood pressure: