************************************************************************* * Program: C:\NHANES\age_adj_prev_sas_9.2.sas * * Proposal: Generate age adjusted prevelance using SAS Survey Procedures* *************************************************************************; 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+' ; VALUE hbpfmt 1 = 'High BP' 2 = 'No high BP' ; VALUE bpfmt 1 = 'High BP' 0 = 'No high BP' ; VALUE hbp2fmt 100 = 'High BP' 0 = 'No high BP' ; run; DATA ANALYSIS_DATA; SET NH.ANALYSIS_DATA; if ridstatr = 2; ***examined ; /*variable created for study subpopulation of interest:used on domain statement for SAS Survey procedure*/ if ridageyr >=20 then sel=1; *else sel=2; age = .; if 20 LE ridageyr LE 39 then age=1; else if 40 LE ridageyr LE 59 then age=2; else if ridageyr GE 60 then age=3; race=.; if ridreth1=3 then race=1; else if ridreth1=4 then race=2; else if ridreth1=1 then race=3; else if ridreth1=2 or ridreth1=5 then race=4; *** code to define mean blood pressure measures and HBP ****; n_sbp = n(of bpxsy1-bpxsy4); n_dbp = n(of bpxdi1-bpxdi4); *Setting DBP values of 0 as missing for calculating average; array _DBP bpxdi1-bpxdi4; do over _DBP; if (_DBP = 0) then _DBP = .; end; mean_sbp = mean(of bpxsy1-bpxsy4); mean_dbp = mean(of bpxdi1-bpxdi4); if BPQ050a=1 then HBP_trt=1; else if BPQ020 in (1,2) and BPQ050a < 7 then HBP_trt=0; if n_sbp>0 and n_dbp>0 then do; if mean_sbp>=140 then SBP140=1; else SBP140=0; if mean_dbp>=90 then DBP90=1; else DBP90=0; end; if HBP_trt>=0 and SBP140>=0 and DBP90>=0 then do; if HBP_trt=1 or SBP140=1 or DBP90=1 then HBP=1; else HBP=2; end; if hbp=1 then hbpx=100; if hbp=2 then hbpx=0; LABEL age = 'AGE GROUP' race = 'Race Ethnicity' riagendr = 'Gender' ; RUN; title; /*race/ethnicity*/ PROC SURVEYREG data=analysis_data nomcar; STRATA sdmvstra; CLUSTER sdmvpsu; CLASS race age; WEIGHT wtmec4yr; DOMAIN sel; MODEL hbpx=race age race*age /noint solution vadjust=none; ESTIMATE 'NH White ' race 1 0 0 0 age .3966 .3718 .2316 race*age .3966 .3718 .2316 0 0 0 0 0 0 0 0 0; ESTIMATE 'NH Black ' race 0 1 0 0 age .3966 .3718 .2316 race*age 0 0 0 .3966 .3718 .2316 0 0 0 0 0 0; ESTIMATE 'Mex Amer ' race 0 0 1 0 age .3966 .3718 .2316 race*age 0 0 0 0 0 0 .3966 .3718 .2316 0 0 0; ods OUTPUT estimates=ageadj_prev1; *ods select ParameterEstimates Estimates; TITLE 'Age-standardized prevalence of persons 20 years and older with high blood pressure: NHANES 1999-2002'; run; /*total*/ PROC SURVEYREG data=analysis_data nomcar; STRATA sdmvstra; CLUSTER sdmvpsu; CLASS age; WEIGHT wtmec4yr; DOMAIN sel; MODEL hbpx = age /noint solution vadjust=none; ESTIMATE 'Total ' age .3966 .3718 .2316; ods OUTPUT estimates=ageadj_prev1a; *ods select ParameterEstimates Estimates; TITLE 'Age-standardized prevalence of persons 20 years and older with high blood pressure: NHANES 1999-2002'; run; *by gender, race/ethnicity; PROC SURVEYREG data=analysis_data nomcar; STRATA sdmvstra; CLUSTER sdmvpsu; CLASS riagendr race age; WEIGHT wtmec4yr; DOMAIN sel; MODEL hbpx=riagendr race age riagendr*race*age /noint solution vadjust=none; ESTIMATE 'NH White Men' riagendr 1 0 race 1 0 0 0 age .3966 .3718 .2316 riagendr*race*age .3966 .3718 .2316 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; ESTIMATE 'NH Black Men' riagendr 1 0 race 0 1 0 0 age .3966 .3718 .2316 riagendr*race*age 0 0 0 .3966 .3718 .2316 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; ESTIMATE 'Mex Amer men' riagendr 1 0 race 0 0 1 0 age .3966 .3718 .2316 riagendr*race*age 0 0 0 0 0 0 .3966 .3718 .2316 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0; ESTIMATE 'NH White Women' riagendr 0 1 race 1 0 0 0 age .3966 .3718 .2316 riagendr*race*age 0 0 0 0 0 0 0 0 0 0 0 0 .3966 .3718 .2316 0 0 0 0 0 0 0 0 0; ESTIMATE 'NH Black Women' riagendr 0 1 race 0 1 0 0 age .3966 .3718 .2316 riagendr*race*age 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .3966 .3718 .2316 0 0 0 0 0 0; ESTIMATE 'Mex Amer Women' riagendr 0 1 race 0 0 1 0 age .3966 .3718 .2316 riagendr*race*age 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .3966 .3718 .2316 0 0 0; ods OUTPUT estimates=ageadj_prev2; *ods select ParameterEstimates Estimates; TITLE 'Age-standardized prevalence of persons 20 years and older with high blood pressure: NHANES 1999-2002'; run; /*gender*/ PROC SURVEYREG data=analysis_data nomcar; STRATA sdmvstra; CLUSTER sdmvpsu; CLASS riagendr age; WEIGHT wtmec4yr; DOMAIN sel; MODEL hbpx=riagendr age riagendr*age/noint solution vadjust=none; ESTIMATE 'Males ' riagendr 1 0 age .3966 .3718 .2316 riagendr*age .3966 .3718 .2316 0 0 0; ESTIMATE 'Females ' riagendr 0 1 age .3966 .3718 .2316 riagendr*age 0 0 0 .3966 .3718 .2316; ods OUTPUT estimates=ageadj_prev2a; *ods select ParameterEstimates Estimates; TITLE 'Age-standardized prevalence of persons 20 years and older with high blood pressure: NHANES 1999-2002'; run; data all_ageadj; set ageadj_prev1a ageadj_prev1 ageadj_prev2a ageadj_prev2; proc print; var estimatelabel estimate stderr; title 'Age-standardized prevalence of persons 20 years and older with high blood pressure: NHANES 1999-2002'; run; *SOURCE: SAS 9.2 Documentation SAS/STAT(R) 9.2 User's Guide *Note: NOMCAR requests that the procedure treat missing values in the variance computation as not missing completely at random (NOMCAR) for Taylor series variance estimation. When you specify the NOMCAR option, PROC SURVEYREG computes variance estimates by analyzing the nonmissing values as a domain or subpopulation, where the entire population includes both nonmissing and missing domains. See the section Missing Values for more details. By default, PROC SURVEYREG completely excludes an observation from analysis if that observation has a missing value, unless you specify the MISSING option. Note that the NOMCAR option has no effect on a classification variable when you specify the MISSING option, which treats missing values as a valid nonmissing level. The NOMCAR option applies only to Taylor series variance estimation. The replication methods, which you request with the VARMETHOD=BRR and VARMETHOD=JACKKNIFE options, do not use the NOMCAR option. *Note: that when there is a CLASS statement, you need to use the SOLUTION option with the CLPARM option to obtain the parameter estimates and their confidence limits. VADJUST=DF | NONE specifies whether to use degrees of freedom adjustment in the computation of the matrix for the variance estimation. If you do not specify the VADJUST= option, by default, PROC SURVEYREG uses the degrees-of-freedom adjustment that is equivalent to the VARADJ=DF option. If you do not want to use this variance adjustment, you can specify the VADJUST=NONE option.