/* This file was created by Molly Fifer */ clear set mem 500m set more off program drop _all cd c:/data/PATS/data /* Identify those in persistent moderate-to-severe pain as those who give a pain rating of greater than 3 for all 3 episodes selected. Compare those in chronic pain and the rest of the sample on the following dimensions: i. Gender ii. Income brackets iii. Age: 10-year brackets currently used in the data iv. Race/ethnicity: Hispanic, White, Black, Asian v. Education: LTHS, HS, some college, college, college plus vi. Marital status vii. Life satisfaction viii. Disability status ix. Self-reported health satisfaction */ use krueger, clear /* Drop weekend days from the sample */ drop if diaryday=="Saturday" | diaryday=="Sunday" keep if PAIN>3 & PAIN<=6 collapse (count) age, by(fprimary) keep if age==3 gen chronic=1 sort fprimary drop age save merge, replace use krueger, clear drop if diaryday=="Saturday" | diaryday=="Sunday" sort fprimary merge fprimary using merge tab _merge drop _merge replace chronic=0 if chronic==. save chronic, replace collapse chronic, by(fprimary) tab chronic use chronic, clear rename d4 hisp rename d401 race_1 rename d402 race_2 rename d403 race_3 rename d404 race_4 label var fprimary "Respondent ID" label var age "Age" label var pwt "Sample weight" label var ret "Retired" label var fprimary "Respondent ID" label var diaryday "Diary day" label var age "Age" label var pwt "Sample weight" label var ret "Retired" gen male=0 if sex~=. replace male=1 if sex==1 gen female=0 if sex~=. replace female=1 if sex==2 gen hhinclt30=0 if income<=9 replace hhinclt30=1 if income>=1&income<=3 gen hhinc30_49=0 if income<=9 replace hhinc30_49=1 if income>=4&income<=5 gen hhinc50_99=0 if income<=9 replace hhinc50_99=1 if income>=6&income<=7 gen hhincge100=0 if income<=9 replace hhincge100=1 if income>7&income<98 gen agelt20=0 if age~=. replace agelt20=1 if age<20 gen age20_29=0 if age~=. replace age20_29=1 if age>=20&age<30 gen age30_39=0 if age~=. replace age30_39=1 if age>=30&age<40 gen age40_49=0 if age~=. replace age40_49=1 if age>=40&age<50 gen age50_59=0 if age~=. replace age50_59=1 if age>=50&age<60 gen age60_69=0 if age~=. replace age60_69=1 if age>=60&age<70 gen age70_79=0 if age~=. replace age70_79=1 if age>=70&age<80 gen age80_89=0 if age~=. replace age80_89=1 if age>=80&age<90 gen age90_99=0 if age~=. replace age90_99=1 if age>=90&age<100 gen age18_24=0 if age~=. replace age18_24=1 if age>=18&age<=24 gen age25_34=0 if age~=. replace age25_34=1 if age>=25&age<=34 gen age35_44=0 if age~=. replace age35_44=1 if age>=35&age<=44 gen age45_54=0 if age~=. replace age45_54=1 if age>=45&age<=54 gen age55_64=0 if age~=. replace age55_64=1 if age>=55&age<=64 gen age65_74=0 if age~=. replace age65_74=1 if age>=65&age<=74 gen agege75=0 if age~=. replace agege75=1 if age>=75 replace hisp=. if hisp>=8 replace hisp=0 if hisp==2 gen white=0 if race_1<=4 & hisp~=. replace white=1 if race_1==1&hisp==0&race_2==. gen black=0 if race_1<=4 & hisp~=. replace black=1 if race_1==2&hisp==0&race_2==. gen asian=0 if race_1<=4 & hisp~=. replace asian=1 if race_1==3&hisp==0&race_2==. gen lths=0 if educ<=16 replace lths=1 if educ<=8 gen hsed=0 if educ<=16 replace hsed=1 if educ==9 gen somecoll=0 if educ<=16 replace somecoll=1 if educ>9&educ<=12 gen colled=0 if educ<=16 replace colled=1 if educ==13 gen gtcoll=0 if educ<=16 replace gtcoll=1 if educ>13&educ<98 gen married=0 if marital<=6 replace married=1 if marital==2 gen notmarried=0 if marital<=6 replace notmarried=1 if marital~=2 & marital<=6 gen life_notatall=0 if lisat<=4 replace life_notatall=1 if lisat==1 gen life_notsat=0 if lisat<=4 replace life_notsat=1 if lisat==2 gen life_sat=0 if lisat<=4 replace life_sat=1 if lisat==3 gen life_verysat=0 if lisat<=4 replace life_verysat=1 if lisat==4 gen health_notatall=0 if hlsat<=4 replace health_notatall=1 if hlsat==1 gen health_notsat=0 if hlsat<=4 replace health_notsat=1 if hlsat==2 gen health_sat=0 if hlsat<=4 replace health_sat=1 if hlsat==3 gen health_verysat=0 if hlsat<=4 replace health_verysat=1 if hlsat==4 replace disabled=0 if disabled==2 replace disabled=. if disabled>=8 gen notdisabled=0 if disabled~=. replace notdisabled=1 if disabled==0 sort fprimary by fprimary: gen n=_n keep if n==1 drop n save chronic, replace /* Demographic characteristic comparisons: what percent of women (...) are chronic pain experiencers */ /* Generate means and standard errors on the differences by demographic characteristic. */ use chronic, clear program drop _all gen group="" gen mean=. program table sum chronic if `2'==1 [aw=pwt] replace mean=r(mean) in `1' replace group="`2'" in `1' matrix drop _all end table 1 male table 2 female table 3 hhinclt30 table 4 hhinc30_49 table 5 hhinc50_99 table 6 hhincge100 table 7 agelt20 table 8 age20_29 table 9 age30_39 table 10 age40_49 table 11 age50_59 table 12 age60_69 table 13 age70_79 table 14 age80_89 table 15 age90_99 table 16 age18_24 table 17 age25_34 table 18 age35_44 table 19 age45_54 table 20 age55_64 table 21 age65_74 table 22 agege75 table 23 white table 24 black table 25 asian table 26 hisp table 27 lths table 28 hsed table 29 somecoll table 30 colled table 31 gtcoll table 32 married table 33 notmarried table 34 life_notatall table 35 life_notsat table 36 life_sat table 37 life_verysat table 38 health_notatall table 39 health_notsat table 40 health_sat table 41 health_verysat table 42 disabled table 43 notdisabled keep group mean keep if mean~=. gen order=_n save chronicdemo2, replace /* Doing chi-squared tests on the differences */ use chronic, clear program drop _all gen group="" program table reg `1' male female [aw=pwt], cluster(fprimary) noconstant test male=female replace chi`1'=r(p) in 1/2 replace group="male" in 1 replace group="female" in 2 reg `1' hhinclt30 hhinc30_49 hhinc50_99 hhincge100 [aw=pwt], cluster(fprimary) noconstant test hhinclt30=hhinc30_49=hhinc50_99=hhincge100 replace chi`1'=r(p) in 3/6 replace group="hhinclt30" in 3 replace group="hhinc30_49" in 4 replace group="hhinc50_99" in 5 replace group="hhincge100" in 6 reg `1' agelt20 age20_29 age30_39 age40_49 age50_59 age60_69 age70_79 age80_89 age90_99 [aw=pwt], cluster(fprimary) noconstant test agelt20=age20_29=age30_39=age40_49=age50_59=age60_69=age70_79=age80_89=age90_99 replace chi`1'=r(p) in 7/15 replace group="agelt20" in 7 replace group="age20_29" in 8 replace group="age30_39" in 9 replace group="age40_49" in 10 replace group="age50_59" in 11 replace group="age60_69" in 12 replace group="age70_79" in 13 replace group="age80_89" in 14 replace group="age90_99" in 15 reg `1' age18_24 age25_34 age35_44 age45_54 age55_64 age65_74 agege75 [aw=pwt], cluster(fprimary) noconstant test age18_24=age25_34=age35_44=age45_54=age55_64=age65_74=agege75 replace chi`1'=r(p) in 16/22 replace group="age18_24" in 16 replace group="age25_34" in 17 replace group="age35_44" in 18 replace group="age45_54" in 19 replace group="age55_64" in 20 replace group="age65_74" in 21 replace group="agege75" in 22 reg `1' white black asian hisp [aw=pwt], cluster(fprimary) noconstant test white=black=asian=hisp replace chi`1'=r(p) in 23/26 replace group="white" in 23 replace group="black" in 24 replace group="asian" in 25 replace group="hisp" in 26 reg `1' lths hsed somecoll colled gtcoll [aw=pwt], cluster(fprimary) noconstant test lths=hsed=somecoll=colled=gtcoll replace chi`1'=r(p) in 27/31 replace group="lths" in 27 replace group="hsed" in 28 replace group="somecoll" in 29 replace group="colled" in 30 replace group="gtcoll" in 31 reg `1' married notmarried [aw=pwt], cluster(fprimary) noconstant test married=notmarried replace chi`1'=r(p) in 32/33 replace group="married" in 32 replace group="notmarried" in 33 reg `1' life_notatall life_notsat life_sat life_verysat [aw=pwt], cluster(fprimary) noconstant test life_notatall=life_notsat=life_sat=life_verysat replace chi`1'=r(p) in 34/37 replace group="life_notatall" in 34 replace group="life_notsat" in 35 replace group="life_sat" in 36 replace group="life_verysat" in 37 reg `1' health_notatall health_notsat health_sat health_verysat [aw=pwt], cluster(fprimary) noconstant test health_notatall=health_notsat=health_sat=health_verysat replace chi`1'=r(p) in 38/41 replace group="health_notatall" in 38 replace group="health_notsat" in 39 replace group="health_sat" in 40 replace group="health_verysat" in 41 reg `1' disabled notdisabled [aw=pwt], cluster(fprimary) noconstant test disabled=notdisabled replace chi`1'=r(p) in 42/43 replace group="disabled" in 42 replace group="notdisabled" in 43 end program pain gen chi`1'=. table `1' end pain chronic keep group chi* keep if chichronic~=. sort group save merge, replace use chronicdemo2, clear sort group merge group using merge tab _merge drop _merge sort order drop order save chronicdemo2, replace outsheet using c:/data/PATS/outsheet/alanarthur/chronicdemo2_pwt.raw, replace