/*Clinic + Home Weight Adjusted*/ /*Program highlights: 1. First uses the Clinic + Home weight because height and weight measurements were obtained at the clinic or home. 2. An Adjustment Weight for the Clinic + Home Weight was then created due to missing data in the subsetted sample. 3. Calculates Crude prevalence estimates of obesity and corresponding Relative Standard Errors (RSEs). 4. Calculates Age-Adjusted prevalence estimates of obesity and corresponding RSEs. */ proc format; /*gender*/ value riagendr 1='Male' 2='Female'; /*Race_eth*/ value race_eth 1='Non-Hisp White' 2='Non-Hisp Black' 3='Non-Hisp Asian' /*(Non-Hispanic Asian and Hawaiian/PI)*/ 4='Hispanic' 5='Non-Hisp Other' /*(American Indian, Other, Multiracial who could not select one race, and SPs missing race but Non-Hispanic)*/; /*Obesity*/ value BMI 1='Normal' 2='Overweight' 3='Obese'; libname hanes 'C:\Data'; proc sort data=hanes.spfile out=spfile; by sp_id; proc sort data=hanes.capi out=capi; by sp_id; proc sort data=hanes.exam out=exam; by sp_id; data obesity; merge spfile (in=a) capi exam (in=b); by sp_id; if a and b; /*Merges SPs with CAPI and Body Measurements*/ if bmxht=. or bmiht=3 or bmxwt=. or bmiwt=4 then delete; /*Limits sample to those SPs with valid Height and Weight values and specifies exclusions*/ /*BMI Definition*/ if 0 LT BMXBMI LT 25 then BMI=1; /*Normal*/ else if 25 LE BMXBMI LT 30 THEN BMI=2; /*Overweight*/ else if BMXBMI ge 30 then BMI=3; /*Obese*/ format riagendr riagendr. race_eth race_eth. BMI BMI.; run; /*Merge in Adjustment Weights for 'CLINIC + HOME' weight - Refer to Analytic Guidelines for further details.*/ /*Sum Clinic + Home weights of the respondents (in subsetted dataset) within each category of age, gender, race/ethnicity - 'SUM B'*/ proc summary data=obesity nway; var wtsf1ch; /*Clinic + Home Weight*/ class agewt riagendr racewt; output out=samplewts sum=samplewt; run; /*The file hanes.int_con_tots contains the sum of the Clinic + Home Control Totals within each category of age, gender, race/ethnicity (from Westat) - 'SUM A'*/ /*Merge SUM B to SUM A to create Weight Factor (A/B)*/ proc sort data=hanes.int_con_tots out=intwts; by agewt riagendr racewt; proc sort data=samplewts; by agewt riagendr racewt; data wtfactor; merge samplewts intwts; by agewt riagendr racewt; wtfactor=clinic_home_control_total/samplewt; /* Weight Factor = A/B */ run; /*Merge dataset with new weight factor to subsetted dataset in order to adjust the weight by the weight factor A/B for each SP in the cell*/ proc sort data=wtfactor; by agewt riagendr racewt; proc sort data=obesity; by agewt riagendr racewt; run; data obadwt; merge obesity wtfactor; by agewt riagendr racewt; obwt = wtsf1ch * wtfactor; /*New weight = Old weight * (A/B)*/ run; /*Check adjusted weight*/ proc summary data=obadwt nway; var obwt; output out=popchk sum=pop; run; proc print data=popchk; run; /*5,827,719*/ /*Delete pregnant women*/ data obadjwt; set obadwt; if rhq142=1 then delete; run; /*SUDAAN CODE*/ /*Obesity Prevalence - CRUDE (using PROC CROSSTAB)*/ proc sort data=obadjwt; by stratum psu; run; PROC CROSSTAB data=obadjwt; NEST STRATUM PSU; WEIGHT obwt; /*Adjusted Clinic + Home Weight*/ subgroup BMI riagendr agegroup race_eth; LEVELS 3 2 5 5; TABLES RIAGENDR*BMI; RTITLE "Obesity Prevalence Among NYC Population, by Gender - Crude"; PRINT NSUM="SAMSIZE" WSUM="POPSIZE" ROWPER SEROW lowrow uprow/ TESTS=ALL WSUMFMT=F9.0 SEROWFMT= F6.3 style=nchs; output/filename=BMIcrude filetype=sas TABLECELL=DEFAULT REPLACE; SETENV COLWIDTH=14 DECWIDTH=2 COLSPCE=2; run; /*Calculate Relative Standard Error of the estimates using the SUDAAN output dataset. Typically, estimates with RSE >=30% are considered unreliable and notated that it should be interpreted with caution.*/ data rse; set BMIcrude; RSE=round(serow/rowper*100,0.1); run; /*Obesity Prevalence - Age-Adjusted (using PROC DESCRIPT)*/ proc sort data=obadjwt; by stratum psu; run; PROC descript data=obadjwt; NEST STRATUM PSU; WEIGHT obwt; /*Adjusted Clinic + Home Weight*/ var BMI BMI BMI; catlevel 1 2 3; subgroup BMI riagendr ageadj race_eth; LEVELS 3 2 3 5; TABLES RIAGENDR; stdvar ageadj; stdwgt 0.396579 0.371795 0.231626; RTITLE "Obesity Prevalence Among NYC Population, by Gender - Age-Adjusted"; PRINT NSUM="SAMSIZE" WSUM="POPSIZE" total percent sepercent lowpct uppct/ WSUMFMT=F8.0 totalfmt=f8.0 percentfmt=f8.1 lowpctfmt=f8.1 uppctfmt=f8.1 SEpercentFMT=F3.1 style=nchs; output/filename=BMIagead filetype=sas TABLECELL=DEFAULT percentfmt=f8.1 lowpctfmt=f8.1 uppctfmt=f8.1 REPLACE; SETENV COLWIDTH=14 DECWIDTH=2 COLSPCE=2; run; /*Calculate Relative Standard Error of the estimates using the SUDAAN output dataset. Typically, estimates with RSE >=30% are considered unreliable and notated that it should be interpreted with caution.*/ data rse; set BMIagead; RSE=round(sepercent/percent*100,0.1); run;