**************************************************************************************************; * Example SUDAAN code to replicate NCHS Data Brief No. 511, Figures 1-5 * Hypertension Prevalence, Awareness, Treatment, and Control Among Adults Age 18 and Older: * United States, August 2021–August 2023 * * Citation: * Fryar CD, Kit B, Carroll MD, Afful J. * Hypertension prevalence, awareness, treatment, and control among adults age 18 and older: * United States, August 2021–August 2023. NCHS Data Brief, no 511. Hyattsville, MD: * National Center for Health Statistics. 2024. DOI: https://dx.doi.org/10.15620/cdc/164016. **************************************************************************************************; /************************************************ define libname *************************************************/ options nocenter nodate nonumber pagesize=100 linesize=150; OPTIONS FORMCHAR="|----|+|---+=|-/\<>*"; run; /************************************************ download data *************************************************/ /*define paths to datasets*/ /*2021-2023*/ filename DEMO_L url 'https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2021/DataFiles/DEMO_L.xpt'; libname DEMO_L xport; filename BPXO_L url 'https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2021/DataFiles/BPXO_L.xpt'; libname BPXO_L xport; filename BPQ_L url 'https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2021/DataFiles/BPQ_L.xpt'; libname BPQ_L xport; /*2017-2020*/ filename P_DEMO url 'https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2017/DataFiles/P_DEMO.xpt'; libname P_DEMO xport; filename P_BPXO url 'https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2017/DataFiles/P_BPXO.xpt'; libname P_BPXO xport; filename P_BPQ url 'https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2017/DataFiles/P_BPQ.xpt'; libname P_BPQ xport; /*read in sas transport files and append across survey cycles*/ data demo; set DEMO_L.DEMO_L P_DEMO.P_DEMO; run; data bpxo; set BPXO_L.BPXO_L P_BPXO.P_BPXO; run; data bpq; set BPQ_L.BPQ_L P_BPQ.P_BPQ; run; /*merge files*/ proc sort data=demo; by seqn; run; proc sort data=bpxo; by seqn; run; proc sort data=bpq; by seqn; run; data data_1723; merge demo bpxo bpq; by seqn; run; /************************************************ data prep *************************************************/ /*labels for variables*/ proc format; value agefmt 1='18-39 years' 2='40-59 years' 3='60 years and over'; value sex 1='male' 2='female'; value htn 1="130/80 htn" 0="no htn"; value htn_control 1="controlled" 0="not controlled"; value htn_aware 1="aware" 0="unaware"; value htn_treat 1="treated" 0="untreated"; run; /*define variables*/ data data_1723; set data_1723; /*age*/ if (18 LE ridageyr LE 39) then agecat=1; else if (40 LE ridageyr LE 59) then agecat=2; else if ridageyr ge 60 then agecat=3; /*htn variables*/ /*count number of nonmissing sbp and dbp*/ n_sbp = n(of bpxosy1-bpxosy3); n_dbp = n(of bpxodi1-bpxodi3); /*calculate mean sbp and dbp*/ mean_sbp = mean(of bpxosy1-bpxosy3); mean_dbp = mean(of bpxodi1-bpxodi3); /*htn*/ if (mean_sbp >= 130 or mean_dbp >= 80 or bpq050a = 1 or bpq150=1) then do; htn = 1; if (mean_sbp >= 130 or mean_dbp >= 80) then htn_control = 0; else if (n_sbp > 0 and n_dbp > 0) then htn_control = 1; end; else if (n_sbp > 0 and n_dbp > 0) then htn = 0; /*htn_aware*/ if bpq020=1 then htn_aware=1; else if bpq020=2 then htn_aware=0; /*htn_treat*/ if bpq050a=1 or bpq150=1 then htn_treat=1; else if bpq040a=2 or bpq020=2 or bpq050a=2 or bpq150=2 then htn_treat=0; run; /*subset 2021-2023 only*/ data data_2123; set data_1723; if sddsrvyr=12; run; /********************************************************************************** Figure 1: Prevalence of hypertension in adults age 18 and older, by sex and age: United States, August 2021–August 2023 ***********************************************************************************/ /**** figure 1 age-adjusted estimates ****/ *age-adjustment weights for adults aged 18 and over from estimated year 2000 Census population, with age groups 18-39,40-59, 60+ years; %let ageShares = 0.4203 0.3572 0.2225; proc descript data=data_2123 notsorted atlevel1=1 atlevel2=2 ; /*nest statement: PSUs nested within Strata accounts for the design effects*/ nest sdmvstra sdmvpsu; /*weight statement: specify appropriate weight, accounts for the unequal probability of sampling and non-response*/ weight wtmec2yr; /*subpopx statement: specify the subpopulation of interest*/ subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0); /*class statement: specify categorical variable(s)*/ class riagendr agecat /nofreq; /*var statement: specify the analysis variable(s),and the level(s) of the analysis variable*/ var htn; catlevel 1; /*Stdvar statement: specifies the variables used to calculate the standard age proportions*/ stdvar agecat; /*Stdwgt statement: specifies the precalculated standard age proportions*/ stdwgt &ageShares; /*Table(s) statement: specifies cross-tabulations for which estimates are requested *request age-standardized estimates of interest also request age-specific estimates (i.e. interaction with agecat) which are needed to calculate Korn and Graubard confidence intervals*/ tables riagendr*agecat; print nsum percent sepercent lowpct uppct/style=nchs percentfmt=f8.1 lowpctfmt=f8.1 uppctfmt=f8.1; output nsum percent sepercent atlev1 atlev2 /filename=fig1_age_adj percentfmt=f8.1 sepercentfmt=f8.1 replace; rtitle "Age-adjusted prevalence of hypertension in adults age 18 and older, by sex and age: United States, August 2021–August 2023"; rfootnote "Age standardized by the direct method to the year 2000 census population estimates using the age groups 18-39, 40-59, 60+ years"; rformat agecat agefmt.; rformat riagendr sex.; run; /*call macro to calculate Korn and Graubard confidence intervals, for age-adjusted estimates (see the macro documentation for more detail on options)*/ %calculate_KornGraubard_CIs( dsIn=fig1_age_adj, dsOut=fig1_age_adj_KG, age_adjusted=yes, dropAgeSpecific=no); proc print data=fig1_age_adj_KG noobs label; var riagendr agecat nsum percent sepercent lowercl uppercl df CIW RCIW present; title "Data table for Figure 1. Age-adjusted prevalence of hypertension in adults age 18 and older, by sex and age: United States, August 2021–August 2023"; footnote "Estimates for age group 18 and over are age adjusted by the direct method to the U.S. Census 2000 population using age groups 18–39, 40–59, and 60 and over"; run; footnote; /**** figure 1 crude estimates ****/ title "Crude prevalence of hypertension in adults age 18 and older, by sex and age: United States, August 2021–August 2023"; proc descript data=data_2123 notsorted atlevel1=1 atlevel2=2; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0); class riagendr agecat /nofreq; var htn; catlevel 1; tables riagendr*agecat; print nsum percent sepercent lowpct uppct /style=nchs percentfmt=f8.1 lowpctfmt=f8.1 uppctfmt=f8.1; output nsum percent sepercent atlev1 atlev2 /filename=fig1_crude replace; rtitle "Crude prevalence of hypertension in adults age 18 and older, by sex and age: United States, August 2021–August 2023"; rformat agecat agefmt.; rformat riagendr sex.; run; %calculate_KornGraubard_CIs( dsIn=fig1_crude, dsOut=fig1_crude_KG, age_adjusted=no); proc print data=fig1_crude_KG noobs label; var riagendr agecat nsum percent sepercent lowercl uppercl df CIW RCIW present; title "Data table for Figure 1. Crude prevalence of hypertension in adults age 18 and older, by sex and age: United States, August 2021–August 2023"; run; /*t-tests*/ /*compares males vs. females within each age group*/ proc descript data=data_2123 filetype=sas notsorted; /*nest statement: PSUs nested within Strata accounts for the design effects*/ nest sdmvstra sdmvpsu; /*weight statement: specify appropriate weight, accounts for the unequal probability of sampling and non-response*/ weight wtmec2yr; /*subpopx statement: specify the subpopulation of interest (the inclusion criteria*/ subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0); /*class statement: specify categorical variable(s)*/ class agecat riagendr /nofreq; /*var statement: specify the analysis variable(s),and the level(s) of the analysis variable(s)*/ var htn; catlevel 1; /*table(s) statement: specifies cross-tabulations for which estimates are requested. If a table statement is not present, a one-dimensional distribution is generated for each variable in the class statement*/ table agecat; /*pairwise statement: requests all contrasts*/ pairwise riagendr/name="pairwise sex"; print nsum="samsize" percent sepercent T_PCT P_PCT / style=nchs percentfmt=f8.1; rtitle "Pairwise t tests for crude prevalence of hypertension, males vs. females within each age group"; rformat agecat agefmt.; rformat riagendr sex.; run; /*t-tests*/ /*compares age groups within each sex*/ proc descript data=data_2123 filetype=sas notsorted; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0); class agecat riagendr /nofreq; var htn; catlevel 1; table riagendr; pairwise agecat / name="pairwise age group"; poly agecat=1 / name="linear age trend within sex"; print nsum="samsize" percent sepercent T_PCT P_PCT / style=nchs percentfmt=f8.1; rtitle "Pairwise t tests for crude prevalence of hypertension, comparing age groups within each sex"; rformat agecat agefmt.; rformat riagendr sex.; run; /********************************************************************************** Figure 2. Prevalence of hypertension awareness among adults age 18 and older with hypertension, by sex and age: United States, August 2021–August 2023 ***********************************************************************************/ proc descript data=data_2123 notsorted atlevel1=1 atlevel2=2; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class riagendr agecat /nofreq; var htn_aware; catlevel 1; tables riagendr*agecat; print nsum percent sepercent lowpct uppct /style=nchs percentfmt=f8.1 lowpctfmt=f8.1 uppctfmt=f8.1; output nsum percent sepercent atlev1 atlev2 /filename=fig2 replace; rtitle "Prevalence of hypertension awareness in adults age 18 and older with hypertension, by sex and age: United States, August 2021–August 2023"; rformat agecat agefmt.; rformat riagendr sex.; run; %calculate_KornGraubard_CIs( dsIn=fig2, dsOut=fig2_KG, age_adjusted=no); proc print data=fig2_KG noobs label; var riagendr agecat nsum percent sepercent lowercl uppercl df CIW RCIW present; title "Data table for Figure 2. Prevalence of hypertension awareness among adults age 18 and older with hypertension, by sex and age: United States, August 2021–August 2023"; run; /*t-tests*/ /*compares males vs. females within each age group*/ proc descript data=data_2123 filetype=sas notsorted; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class agecat riagendr /nofreq; var htn_aware; catlevel 1; table agecat; pairwise riagendr/name="pairwise sex"; print nsum="samsize" percent sepercent T_PCT P_PCT / style=nchs percentfmt=f8.1; rtitle "Pairwise t tests for prevalence of hypertension awareness among adults age 18 and older with hypertension, males vs. females within each age group"; rformat agecat agefmt.; rformat riagendr sex.; run; /*t-tests*/ /*compares age groups within each sex*/ proc descript data=data_2123 filetype=sas notsorted; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class agecat riagendr /nofreq; var htn_aware; catlevel 1; table riagendr; pairwise agecat / name="pairwise age group"; poly agecat=1 / name="linear age trend within sex"; print nsum="samsize" percent sepercent T_PCT P_PCT / style=nchs percentfmt=f8.1; rtitle "Pairwise t tests for prevalence of hypertension awareness among adults age 18 and older with hypertension, comparing age groups within each sex"; rformat agecat agefmt.; rformat riagendr sex.; run; /********************************************************************************** Figure 3. Prevalence of hypertension treatment among adults age 18 and older with hypertension, by sex and age: United States, August 2021–August 2023 ***********************************************************************************/ proc descript data=data_2123 notsorted atlevel1=1 atlevel2=2; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class riagendr agecat /nofreq; var htn_treat; catlevel 1; tables riagendr*agecat; print nsum percent sepercent lowpct uppct /style=nchs percentfmt=f8.1 lowpctfmt=f8.1 uppctfmt=f8.1; output nsum percent sepercent atlev1 atlev2 /filename=fig3 replace; rtitle "Prevalence of hypertension treatment among adults age 18 and older with hypertension, by sex and age: United States, August 2021–August 2023"; rformat agecat agefmt.; rformat riagendr sex.; run; %calculate_KornGraubard_CIs( dsIn=fig3, dsOut=fig3_KG, age_adjusted=no); proc print data=fig3_KG noobs label; var riagendr agecat nsum percent sepercent lowercl uppercl df CIW RCIW present; title "Data table for Figure 3. Prevalence of hypertension treatment among adults age 18 and older with hypertension, by sex and age: United States, August 2021–August 2023"; run; /*t-tests*/ /*compares males vs. females within each age group*/ proc descript data=data_2123 filetype=sas notsorted; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class agecat riagendr /nofreq; var htn_treat; catlevel 1; table agecat; pairwise riagendr/name="pairwise sex"; print nsum="samsize" percent sepercent T_PCT P_PCT / style=nchs percentfmt=f8.1; rtitle "Pairwise t tests for prevalence of hypertension treatment among adults age 18 and older with hypertension, males vs. females within each age group"; rformat agecat agefmt.; rformat riagendr sex.; run; /*t-tests*/ /*compares age groups within each sex*/ proc descript data=data_2123 filetype=sas notsorted; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class agecat riagendr /nofreq; var htn_treat; catlevel 1; table riagendr; pairwise agecat / name="pairwise age group"; poly agecat=1 / name="linear age trend within sex"; print nsum="samsize" percent sepercent T_PCT P_PCT / style=nchs percentfmt=f8.1; rtitle "Pairwise t tests for prevalence of hypertension treatment among adults age 18 and older with hypertension, comparing age groups within each sex"; rformat agecat agefmt.; rformat riagendr sex.; run; /************************************************************************************************ Figure 4. Prevalence of hypertension control among adults age 18 and older with hypertension, by sex and age: United States, August 2021–August 2023 ************************************************************************************************/ proc descript data=data_2123 notsorted atlevel1=1 atlevel2=2; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class riagendr agecat /nofreq; var htn_control; catlevel 1; tables riagendr*agecat; print nsum percent sepercent lowpct uppct /style=nchs percentfmt=f8.1 lowpctfmt=f8.1 uppctfmt=f8.1; output nsum percent sepercent atlev1 atlev2 /filename=fig4 replace; rtitle "Prevalence of hypertension control among adults age 18 and older with hypertension, by sex and age: United States, August 2021–August 2023"; rformat agecat agefmt.; rformat riagendr sex.; run; %calculate_KornGraubard_CIs( dsIn=fig4, dsOut=fig4_KG, age_adjusted=no); proc print data=fig4_KG noobs label; var riagendr agecat nsum percent sepercent lowercl uppercl df CIW RCIW present; title "Data table for Figure 4. Prevalence of hypertension control among adults age 18 and older with hypertension, by sex and age: United States, August 2021–August 2023"; run; /*t-tests*/ /*compares males vs. females within each age group*/ proc descript data=data_2123 filetype=sas notsorted; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class agecat riagendr /nofreq; var htn_control; catlevel 1; table agecat; pairwise riagendr/name="pairwise sex"; print nsum="samsize" percent sepercent T_PCT P_PCT / style=nchs percentfmt=f8.1; rtitle "Pairwise t tests for prevalence of hypertension control among adults age 18 and older with hypertension, males vs. females within each age group"; rformat agecat agefmt.; rformat riagendr sex.; run; /*t-tests*/ /*compares age groups within each sex*/ proc descript data=data_2123 filetype=sas notsorted; nest sdmvstra sdmvpsu; weight wtmec2yr; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class agecat riagendr /nofreq; var htn_control; catlevel 1; table riagendr; pairwise agecat / name="pairwise age group"; poly agecat=1 / name="linear age trend within sex"; print nsum="samsize" percent sepercent T_PCT P_PCT / style=nchs percentfmt=f8.1; rtitle "Pairwise t tests for prevalence of hypertension control among adults age 18 and older with hypertension, comparing age groups within each sex"; rformat agecat agefmt.; rformat riagendr sex.; run; /************************************************************************************************ Figure 5. Prevalence of hypertension awareness, treatment, and control among adults age 18 and older with hypertension: United States, 2017–March 2020 and August 2021–August 2023 ************************************************************************************************/ /*specify correct weight variable for each cycle*/ data data_1723; set data_1723; if sddsrvyr=66 then wtmec=WTMECPRP; /*2017-Mar 2020*/ else if sddsrvyr=12 then wtmec=wtmec2yr; /*2021-2023*/ run; proc descript data=data_1723 notsorted atlevel1=1 atlevel2=2; nest sdmvstra sdmvpsu; weight wtmec; subpopx ridageyr >=18 and ridexprg ne 1 and (n_sbp ne 0 or n_dbp ne 0) and htn=1; class sddsrvyr riagendr /nofreq; var htn_aware htn_treat htn_control ; catlevel 1 1 1; tables sddsrvyr; print nsum percent sepercent lowpct uppct /style=nchs percentfmt=f8.1 lowpctfmt=f8.1 uppctfmt=f8.1; output nsum percent sepercent atlev1 atlev2 /filename=fig5 replace; rtitle "Prevalence of hypertension awareness, treatment, and control among adults age 18 and older with hypertension: United States, 2017–March 2020 and August 2021–August 2023"; rformat riagendr sex.; run; %calculate_KornGraubard_CIs( dsIn=fig5, dsOut=fig5_KG, age_adjusted=no); /*format variables*/ proc format; value var 1='htn_aware' 2='htn_treat' 3='htn_control'; value sddsrvyr 66='2017-Mar 2020' 12='2021-2023'; run; proc print data=fig5_KG noobs label; var sddsrvyr nsum percent sepercent lowercl uppercl df CIW RCIW present; by variable; format variable var. sddsrvyr sddsrvyr.; title "Data table for Figure 5. Prevalence of hypertension awareness, treatment, and control among adults age 18 and older with hypertension: United States, 2017–March 2020 and August 2021–August 2023"; run;