************************************************************************ * Program: C:\NHANES\adjmeans_sudaan.sas * * Proposal: Generate age adjusted means in SUDAAN * ************************************************************************; LIBNAME NH "C:\NHANES\DATA"; OPTIONS NODATE NOCENTER; option ls=72; proc format; VALUE sexfmt 1 = 'Male' 2 = 'Female' ; VALUE racefmt 1 = 'NH-White' 2 = 'NH-Black' 3 = 'Mex-Am' 4 = 'Other' ; VALUE agefmt 1 = '20-39' 2 = '40-59' 3 = '60+' ; run; DATA ANALYSIS_DATA; SET NH.ANALYSIS_DATA; if ridstatr = 2; ***examined ; age = .; if 20 LE ridageyr LE 39 then age=1; if 40 LE ridageyr LE 59 then age=2; if ridageyr GE 60 then age=3; race=.; if ridreth1=3 then race=1; if ridreth1=4 then race=2; if ridreth1=1 then race=3; if ridreth1=2 or ridreth1=5 then race=4; LABEL age = 'AGE GROUP' race = 'Race Ethnicity' riagendr = 'Gender' ; RUN; title; PROC SORT DATA=analysis_data; BY sdmvstra sdmvpsu ; RUN; proc descript data=analysis_data design=wr ; subpopn ridageyr >=20 ; NEST sdmvstra sdmvpsu; weight wtmec4yr; subgroup riagendr age race ; levels 2 3 4 ; var bmxbmi; table riagendr * race ; stdvar age; /*to otain prevalence not adjusted for age omit the stdvar and stdwgt statements*/ stdwgt 0.3966 0.3718 0.2316 ; PRINT nsum="Sample Size" mean="Adjusted Mean" semean="Standard Error" / nohead notime style=nchs nsumfmt=F7.0 meanfmt=F9.2 semeanfmt=F9.3 ; rformat age AGEFMT.; rformat riagendr SEXFMT.; rformat race racefmt.; rtitle " Age-adjusted means & standard errors of body mass index: NHANES 1999-2002"; *rtitle " Un-adjusted means & standard errors of body mass index: NHANES 1999-2002"; rfootnote "Age adjusted by the direct method to the year 2000 Census population projections using the age groups 20-39, 40-59, and 60+"; run;