/* Data and SAS program to accompany the article "How much does it cost to give birth in the US?" by Rick WIcklin, published 17JAN2018 on The DO Loop blog https://blogs.sas.com/content/iml/2018/01/17/cost-to-give-birth-in-us.html Based on Money magazine (Jan/Feb 2018) and online article http://time.com/money/4995922/how-much-costs-give-birth-state/ Data from FAIR Health https://www.fairhealthconsumer.org/ */ data Vaginal; length State $2; informat Vaginal VaginalMedian VaginalP80 DOLLAR9.; input State Vaginal VaginalMedian VaginalP80; label Vaginal = "Average Cost of Vaginal Delivery" VaginalMedian = "Median Cost of Vaginal Delivery"; datalines; AK $10,413.43 $10,681.28 $11,990.15 AL $5,016.65 $4,884.44 $6,075.93 AR $5,600.38 $5,524.18 $6,922.18 AZ $6,822.46 $6,806.76 $8,652.19 CA $7,625.79 $7,001.03 $9,801.25 CO $6,738.89 $6,648.17 $8,700.33 CT $8,101.76 $7,906.21 $10,124.95 DE $6,387.79 $5,978.86 $7,736.36 FL $7,800.19 $7,391.90 $10,362.30 GA $6,813.31 $6,693.32 $8,542.71 HI $5,742.85 $5,622.85 $6,946.02 IA $5,848.21 $5,647.90 $7,153.12 ID $5,695.40 $5,772.21 $6,619.26 IL $7,526.49 $7,447.68 $9,517.56 IN $6,379.10 $6,347.41 $8,081.98 KS $5,541.32 $5,566.41 $6,819.70 KY $5,904.93 $5,647.04 $7,753.58 LA $5,590.36 $5,409.55 $7,079.67 MA $7,766.89 $7,949.91 $9,589.59 MD $6,782.49 $6,508.44 $8,917.02 ME $5,893.17 $5,879.74 $7,285.59 MI $5,868.42 $5,978.05 $7,199.36 MN $6,298.92 $6,011.99 $7,695.28 MO $5,841.56 $5,904.83 $7,199.23 MS $5,605.43 $5,651.97 $6,906.85 MT $6,041.83 $6,101.17 $7,320.71 NC $6,375.07 $6,407.91 $8,196.78 ND $6,820.19 $7,294.10 $7,978.85 NE $5,431.58 $5,223.61 $6,623.62 NH $6,887.08 $6,207.80 $8,555.64 NJ $9,302.39 $8,755.88 $11,378.83 NM $6,189.19 $5,819.31 $7,733.12 NV $7,157.32 $6,947.47 $9,194.47 NY $8,935.60 $8,449.33 $12,499.37 OH $5,835.75 $5,705.76 $7,113.09 OK $6,003.12 $6,057.96 $7,491.55 OR $6,564.95 $6,725.62 $8,394.73 PA $6,850.09 $6,535.24 $8,885.24 RI $5,400.51 $4,987.38 $7,098.66 SC $6,520.89 $6,141.69 $8,324.71 SD $6,101.65 $6,121.19 $7,768.00 TN $6,747.53 $6,696.51 $8,108.38 TX $7,348.51 $6,923.48 $9,827.31 UT $5,356.87 $5,454.84 $6,251.64 VA $6,953.32 $6,493.98 $8,769.39 VT $6,256.81 $6,502.27 $7,393.78 WA $6,482.46 $6,408.83 $7,861.24 WI $8,314.41 $8,278.86 $10,432.92 WV $5,815.40 $5,717.18 $7,317.21 WY $6,823.32 $7,018.03 $8,296.08 DC $6,387.94 $6,613.82 $8,228.51 ; data CSection; length State $2; informat CSection CSectionMedian CSectionP80 DOLLAR9.; input State CSection CSectionMedian CSectionP80; label CSection = "Average Cost of C-Section Delivery" CSectionMedian = "Median Cost of C-Section Delivery"; datalines; AK $14,527.99 $14,927.76 $16,280.48 AL $7,730.29 $7,404.07 $9,072.52 AR $8,037.43 $7,989.74 $9,378.69 AZ $9,615.50 $9,599.50 $11,739.37 CA $10,674.77 $10,102.40 $12,974.40 CO $9,646.52 $9,358.13 $12,120.52 CT $11,207.93 $11,188.13 $13,949.66 DE $8,640.08 $8,373.46 $10,077.88 FL $10,925.51 $10,514.41 $14,337.65 GA $9,597.73 $9,427.23 $11,646.10 HI $8,265.39 $8,160.38 $9,728.76 IA $8,626.55 $8,456.64 $10,164.62 ID $8,340.70 $8,338.79 $9,360.96 IL $10,737.19 $10,511.16 $13,291.18 IN $9,688.32 $9,355.35 $11,798.04 KS $8,519.25 $8,415.16 $9,880.73 KY $8,772.89 $8,427.77 $11,215.19 LA $7,984.67 $7,791.89 $9,502.41 MA $10,533.53 $10,349.98 $12,824.69 MD $9,353.82 $9,110.67 $11,927.07 ME $8,181.86 $8,093.16 $9,827.63 MI $8,532.54 $8,443.70 $9,892.33 MN $9,339.97 $8,809.20 $11,182.04 MO $8,829.92 $8,883.15 $10,398.53 MS $8,534.39 $8,576.33 $10,108.03 MT $8,602.13 $8,473.76 $10,199.56 NC $9,246.87 $8,971.04 $11,818.04 ND $9,220.56 $9,647.96 $10,703.80 NE $8,372.54 $8,039.19 $9,815.67 NH $10,034.47 $9,409.77 $12,533.85 NJ $13,300.00 $11,637.74 $16,014.14 NM $9,027.97 $8,391.94 $10,817.06 NV $10,198.98 $10,130.72 $12,333.48 NY $11,886.50 $11,387.63 $15,580.26 OH $8,371.49 $8,090.67 $10,248.11 OK $8,688.36 $8,619.79 $10,301.21 OR $9,624.33 $9,569.14 $11,503.57 PA $10,266.22 $9,797.40 $13,133.89 RI $8,337.01 $7,939.74 $9,945.84 SC $8,898.18 $8,727.16 $10,558.88 SD $8,865.98 $8,793.36 $10,762.68 TN $9,400.19 $9,328.75 $10,992.57 TX $10,576.17 $10,199.52 $12,882.94 UT $8,225.64 $8,132.89 $9,476.44 VA $10,288.34 $9,557.10 $13,074.15 VT $10,067.49 $10,644.78 $11,676.35 WA $9,546.26 $9,338.87 $11,559.39 WI $11,640.49 $11,757.92 $14,162.09 WV $8,639.34 $8,429.48 $10,559.67 WY $9,861.47 $10,017.69 $11,509.17 DC $7,438.56 $7,721.03 $9,011.76 ; ods graphics / reset; data BirthCost; merge Vaginal CSection; /* relative additional cost of C-section medians and means */ DiffMedian = CSectionMedian - VaginalMedian; DiffAverage = CSection - Vaginal; run; proc means data=BirthCost; var Vaginal CSection DiffMedian; run; footnote J=L H=7pt "2016-2017 data provided by FAIR Health. Reported in" italic "Money"; /* bar charts of costs of vaginal and C-section delivery, by state */ /* sort by vaginal delivery */ proc sort data=BirthCost out=BirthCostSorted; by VaginalMedian; run; ods graphics / height=720px width=450px subpixel; title "Median Cost to Give Birth in the US"; title2; proc sgplot data=BirthCostSorted subpixel; format CSectionMedian Dollar7.; hbar State / response=CSectionMedian legendlabel="C-Section"; hbar State / response=VaginalMedian legendlabel="Vaginal" barwidth=0.5; xaxis grid display=(nolabel); yaxis discreteorder=data display=(nolabel) labelattrs=(size=6pt) fitpolicy=none offsetmin=0.01 offsetmax=0.01 /* half of 1/k, where k=number of catgories */ ; keylegend / position=topright location=inside across=1 opaque; run; /* sort by C-section costs */ proc sort data=BirthCost out=BirthCostSorted; by CSectionMedian; run; proc sgplot data=BirthCostSorted subpixel; format CSectionMedian Dollar7.; hbar State / response=CSectionMedian legendlabel="C-Section"; hbar State / response=VaginalMedian legendlabel="Vaginal" barwidth=0.5; xaxis grid display=(nolabel); yaxis discreteorder=data display=(nolabel) labelattrs=(size=6pt) fitpolicy=none offsetmin=0.01 offsetmax=0.01 /* half of 1/k, where k=number of catgories */ ; keylegend / position=topright location=inside across=1 opaque; run; footnote; /* box plot of incremental cost of C-section over vaginal delivery */ ods graphics / width=480px height=140px; title "Difference Between Caesarian and Vaginal Deliveries"; proc sgplot data=BirthCost; hbox DiffMedian / datalabel=State datalabelattrs=(size=12); xaxis display=(nolabel); run; /* scatter plot of median cost of vaginal and C-section delivery for each state */ title "How Much Does It Cost To Give Birth?"; title2 "US Data by State"; ods graphics / height=480px width=480px; proc sgplot data=BirthCost aspect=1 noautolegend; scatter x=VaginalMedian y=CSectionMedian / datalabel=State markerattrs=(symbol=CircleFilled); xaxis grid; yaxis grid; run; title "How Much Does It Cost To Give Birth?"; title2 "US Data by State, Excluding Alaska"; proc sgplot data=BirthCost aspect=1 noautolegend; where State ^= "AK"; scatter x=VaginalMedian y=CSectionMedian / datalabel=State markerattrs=(symbol=CircleFilled); xaxis grid; yaxis grid; run; /* proc reg data=BirthCost plots=none; model CSectionMedian = VaginalMedian; id State; ods select ParameterEstimates; run; proc sgplot data=BirthCost aspect=1 noautolegend; reg x=Vaginal y=CSection / nomarkers transparency=0.5; scatter x=Vaginal y=CSection / datalabel=State; xaxis grid min=5000 max=13000; yaxis grid min=7000 max=15000; run; */ /* You would expect that means costs are greater than median costs in many states. ods graphics / reset; data BirthCost; merge Vaginal CSection; DiffMedian = CSectionMedian - VaginalMedian; * increase of medians; DiffAverage = CSection - Vaginal; * increase of averages; CDAM = CSection - CSectionMedian; * mean - median for CSection; VDAM = Vaginal - VaginalMedian; * mean - median for vaginal; run; proc sgplot data=BirthCost; scatter x=VDAM y=CDAM / datalabel=State; xaxis grid; yaxis grid; run; data A; set BirthCost; VaginalMeanGreater = (Vaginal > VaginalMedian); CSectionMeanGreater = (CSection > CSectionMedian); run; proc freq data=A; tables VaginalMeanGreater * CSectionMeanGreater / norow nocol nopercent; run; */