In this example, you will use SAScallable SUDAAN to generate tables of geometric means, standard errors and 95% confidence intervals for Mono(2ethyl)hexyl phthalate by age, sex, raceethnicity, and survey cycle.
To calculate the geometric means and standard errors, you will use SAScallable SUDAAN because this software takes into account the complex survey design of NHANES data when determining variance estimates. The SUDAAN procedure, proc descript, is used to generate geometric means and standard errors. The output statement is used to output those estimates along with the sample size (nsum) (i.e., the number of survey participants with known values for the variable of interest). The general program for obtaining weighted geometric means and standard errors is below.
The design variables, sdmvstra and sdmvpsu, are provided in the demographic data files and are used to calculate variance estimates.
Statements  Explanation 

Use the proc descript procedure to generate geometric means and specify the sample design using the design option WR (with replacement). The data statement refers to the permanent dataset, Phthalate_analysis_data, created in module 10. The option noprint is used to limit the output that is printed. The option notsorted is used since you did not use the SAS procedure proc sort to sort the dataset by strata (sdmvstra) and PSU (sdmvpsu). The atlevel=1 (strata) and atlevel=2 (PSU) are necessary to calculate the degrees of freedom for the tstatistic. 

Use the nest statement with strata (sdmvstra) and PSU (sdmvpsu) to account for the design effects. 

weight 
Use the weight statement to account for the unequal probability of sampling and nonresponse. In this example, the 6year Phthalate Subsample Weight (WTSPH6YR) is used. 
Use the subgroup statement lists the categorical variables for which statistics are requested. This example uses 5 age categories (age5cat), gender (riagendr), raceethnicity (reth4cat) and survey cycle (sddsrvyr). These variables also appear in the table statement. 

5 2 3 3 
Use the levels statement to define the number of categories in each of the subgroup variables. The level must be an integer greater than 0. This example uses five age categories, two genders, three raceethnicity groups and three survey cycles. 
var 
Use the var statement to name the variable(s) to be analyzed. In this example, the Mono(2ethyl)hexyl phthalate variable (URXMHP) is used. 
table 
Use the table statement to specify tabulations for which estimates are requested. If a table statement is not present, a one—dimensional distribution is generated for each variable in the subgroup statement. In this example the estimates are for age categories (age5cat), gender (riagendr), raceethnicity (reth4cat) and survey cycle (sddsrvyr). 
output 
Use the output statement to create a dataset that can be used to calculate a 95% confidence interval for the geometric mean. In this example, the sample size (nsum), geometric mean (geomean), standard error of the geometric mean (segeomean), PSU (atlev2) and strata (atlev1) are output to a dataset named out3d. The replace option is necessary when creating a dataset in the output statement. Note: For a complete list of statistics that can be requested on the output statement see SUDAAN Users Manual. 
"Geometric Means of Mono(2ethyl)hexyl phthalate and standard error for age, sex, raceethnicity and survey cycle: NHANES 19992004" 
Use the rtitle statement to assign a heading for each page of output. 
The run statement signifies the end of the procedure. 

Result1 keep=Analyte Demo Nsum geomean segeomean L95CI_T U95CI_T)  Create a new dataset (result1) to calculate the 95% confidence interval of the geometric mean. The keep statement indicates the variables that will be kept in the final dataset. 
set 
The set statement sets the dataset that was created in the output statement above. 

Data step to calculate the degrees of freedom used with the tstatistic. Degrees of freedom are calculated by subtracting the strata (atlev1) from the PSU (atlev2). 

Data step to calculate the lower (L95CI_T) and upper (U95CI_T) confidence interval of the geometric mean using the tdistribution (tinv) and the standard error of the geometric mean (segeomean) calculated in the proc descript procedure above. 

Use the length statement to define the lengths of new variables created in the data step. 

Define new variables using if/then statements. 
Only select records where the demo variable is not equal (^=) to missing. 

The run statement signifies the end of the data step. 

Use proc print to view the results of the data step. 

The id statement identifies the analyte and the demographic variable being displayed. 

The var statement identifies the variables to be displayed in the output window. 

The title statement assigns a heading for the output. 

The footnote statement assigns a footnote for the output. 

The run statement signifies the end of the procedure. 
The output will list the sample sizes, geometric means, standard error of the geometric mean and the upper and lower 95% confidence interval.
Close Window to return to module page.