University of North Carolina at Chapel Hill



Stata Syntax for Section 5.8.1, Chapter 5Section 5.8.1________________________________________________________________________//Chapter 5 Illustrating Example 1 (Section 5.8.1)cd "D:\psa_e2\Chapter5\data"cap mkdir "C:\tmp" /* create a new folder to store temporary data */set more offlog using “c:\tmp\r5”, replaceclearset memory 400muse chpt5_1_original,replace //logistic 1logistic aodserv married high bahigh poverty2 poverty3 ///poverty4 poverty5 employ open black hispanic natam chdage1 chdage2 ///chdage3 cgrage1 cgrage2 cgrage3 CRA47A mental arrest PSH17A ///sexual provide supervis other, coefpredict p1//logistic 2logistic aodserv married high bahigh poverty2 poverty3 ///poverty4 poverty5 employ open black hispanic natam chdage1 chdage2 ///chdage3 cgrage1 cgrage2 cgrage3 CRA47A mental arrest PSH17A ///sexual provide supervis other ra cidi cgneed cwwrep, coefpredict p2//logistic 3logistic aodserv married high bahigh poverty2 poverty3 ///poverty4 poverty5 employ open black hispanic natam chdage1 chdage2 ///chdage3 cgrage1 cgrage2 cgrage3 CRA47A mental arrest PSH17A ///sexual provide supervis other ra cidi cgneed, coefpredict p3save chpt5_1, replace//Bivariate test before matchingtab married aodserv if p1 !=., chi2 rowtab educ aodserv if p1 !=., chi2 rowtab pov aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab race aodserv if p1 !=., chi2 rowtab chdage aodserv if p1 !=., chi2 rowtab cgage aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab maltx aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//PSM based on Logistic regression 1//Scheme 1 - Nearest neighbor within caliper .25*SDclearset memory 400muse chpt5_1,replacedrop if p1==.gen logit1=log((1-p1)/p1) sum logit1display .25* 1.242513generate x=uniform()sort xpsmatch2 aodserv, pscore(logit1) caliper(.31062825) noreplacement descendingsort _idg match=id[_n1]g treat=id if _nn==1drop if treat==.sum treatkeep treat matchsave scheme1, replace//Scheme 2 - Nearest neighbor within caliper .1clearset memory 400muse chpt5_1,replacedrop if p1==.gen logit1=log((1-p1)/p1) sum logit1generate x=uniform()sort xpsmatch2 aodserv, pscore(logit1) caliper(.1) noreplacement descendingsort _idg match=id[_n1]g treat=id if _nn==1drop if treat==.sum treatkeep treat matchsave scheme2, replace//Scheme 3 - Mahalanobis 1 same covariates as logistic 1clearset memory 400muse chpt5_1,replaceset seed 1000generate x=uniform()sort x// Mahalanobis without propensity scorepsmatch2 aodserv, mahal(married high bahigh poverty2 poverty3 ///poverty4 poverty5 employ open black hispanic natam chdage1 chdage2 ///chdage3 cgrage1 cgrage2 cgrage3 CRA47A mental arrest PSH17A ///sexual provide supervis other)sort _idgenerate match=id[_n1]generate treat=id if _n1 !=.sum treatkeep treat matchsort matchby match: g mj=_ndrop if treat==.drop if mj != 1sum match keep treat matchsave scheme3, replace//Scheme 4 - Mahalanobis 2 same covariates as logistic 1 with pscore addedclearset memory 400muse chpt5_1,replacedrop if p1==.gen logit1=log((1-p1)/p1) sum logit1set seed 1000generate x=uniform()sort x// Mahalanobis with propensity scorepsmatch2 aodserv, mahal(married high bahigh poverty2 poverty3 poverty4 /// poverty5 employ open black hispanic natam chdage1 chdage2 chdage3 /// cgrage1 cgrage2 cgrage3 CRA47A mental arrest PSH17A sexual provide /// supervis other logit1)sort _idgenerate match=id[_n1]generate treat=id if _n1 !=.sort matchby match: g mj=_ndrop if treat==.drop if mj != 1sum match keep treat matchsave scheme4, replace//PSM based on Logistic regression 2//Scheme 5 - Nearest neighbor within caliper .25*SDclearset memory 400muse chpt5_1,replacedrop if p2==.gen logit2=log((1-p2)/p2) sum logit2display .25*1.95907generate x=uniform()sort xpsmatch2 aodserv, pscore(logit2) caliper(.4897675) noreplacement descendingsort _idg match=id[_n1]g treat=id if _nn==1drop if treat==.sum treatkeep treat matchsave scheme5, replace//Scheme 6 - Nearest neighbor within caliper .1clearset memory 400muse chpt5_1,replacedrop if p2==.gen logit2=log((1-p2)/p2) sum logit2generate x=uniform()sort xpsmatch2 aodserv, pscore(logit2) caliper(.1) noreplacement descendingsort _idg match=id[_n1]g treat=id if _nn==1drop if treat==.sum treatkeep treat matchsave scheme6, replace//Scheme 7 - Mahalanobis 1 same covariates as logistic 2clearset memory 400muse chpt5_1,replaceset seed 1000generate x=uniform()sort x// Mahalanobis without propensity scorepsmatch2 aodserv, mahal(married high bahigh poverty2 poverty3 ///poverty4 poverty5 employ open black hispanic natam chdage1 chdage2 ///chdage3 cgrage1 cgrage2 cgrage3 CRA47A mental arrest PSH17A ///sexual provide supervis other ra cidi cgneed cwwrep)sort _idgenerate match=id[_n1]generate treat=id if _n1 !=.sum treatkeep treat matchsort matchby match: g mj=_ndrop if treat==.drop if mj != 1sum match keep treat matchsave scheme7, replace//Scheme 8 - Mahalanobis 2 same covariates as logistic 2 with pscore addedclearset memory 400muse chpt5_1,replacedrop if p2==.gen logit2=log((1-p2)/p2) sum logit2set seed 1000generate x=uniform()sort x// Mahalanobis with propensity scorepsmatch2 aodserv, mahal(married high bahigh poverty2 poverty3 poverty4 /// poverty5 employ open black hispanic natam chdage1 chdage2 chdage3 /// cgrage1 cgrage2 cgrage3 CRA47A mental arrest PSH17A sexual provide /// supervis other ra cidi cgneed cwwrep logit2)sort _idgenerate match=id[_n1]generate treat=id if _n1 !=.sort matchby match: g mj=_ndrop if treat==.drop if mj != 1sum match keep treat matchsave scheme8, replace//PSM based on Logistic regression 3//Scheme 9 - Nearest neighbor within caliper .25*SDclearset memory 400muse chpt5_1,replacedrop if p3==.gen logit3=log((1-p3)/p3) sum logit3display .25* 1.60411generate x=uniform()sort xpsmatch2 aodserv, pscore(logit3) caliper(.4010275) noreplacement descendingsort _idg match=id[_n1]g treat=id if _nn==1drop if treat==.sum treatkeep treat matchsave scheme9, replace//Scheme 10 - Nearest neighbor within caliper .1clearset memory 400muse chpt5_1,replacedrop if p3==.gen logit3=log((1-p3)/p3) sum logit3generate x=uniform()sort xpsmatch2 aodserv, pscore(logit3) caliper(.1) noreplacement descendingsort _idg match=id[_n1]g treat=id if _nn==1drop if treat==.sum treatkeep treat matchsave scheme10, replace//Scheme 11 - Mahalanobis 1 same covariates as logistic 3clearset memory 400muse chpt5_1,replaceset seed 1000generate x=uniform()sort x// Mahalanobis without propensity scorepsmatch2 aodserv, mahal(married high bahigh poverty2 poverty3 ///poverty4 poverty5 employ open black hispanic natam chdage1 chdage2 ///chdage3 cgrage1 cgrage2 cgrage3 CRA47A mental arrest PSH17A ///sexual provide supervis other ra cidi cgneed)sort _idgenerate match=id[_n1]generate treat=id if _n1 !=.sum treatkeep treat matchsort matchby match: g mj=_ndrop if treat==.drop if mj != 1sum match keep treat matchsave scheme11, replace//Scheme 12 - Mahalanobis 2 same covariates as logistic 3 with pscore addedclearset memory 400muse chpt5_1,replacedrop if p3==.gen logit3=log((1-p3)/p3) sum logit3set seed 1000generate x=uniform()sort x// Mahalanobis with propensity scorepsmatch2 aodserv, mahal(married high bahigh poverty2 poverty3 poverty4 /// poverty5 employ open black hispanic natam chdage1 chdage2 chdage3 /// cgrage1 cgrage2 cgrage3 CRA47A mental arrest PSH17A sexual provide /// supervis other ra cidi cgneed logit3)sort _idgenerate match=id[_n1]generate treat=id if _n1 !=.sort matchby match: g mj=_ndrop if treat==.drop if mj != 1sum match keep treat matchsave scheme12, replace//Bivariate test after matching//Alluse chpt5_1, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme1clearuse scheme1, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme1, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post1, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme2clearuse scheme2, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme2, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post2, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme3clearuse scheme3, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme3, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post3, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme4clearuse scheme4, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme4, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post4, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme5clearuse scheme5, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme5, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post5, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme6clearuse scheme6, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme6, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post6, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme7clearuse scheme7, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme7, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post7, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme8clearuse scheme8, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme8, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post8, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme9clearuse scheme9, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme9, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post9, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme10clearuse scheme10, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme10, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post10, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme11clearuse scheme11, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme11, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post11, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//scheme12clearuse scheme12, replacekeep treatgen tx=1rename treat idsave "C:\tmp\t1.dta",replaceuse scheme12, replacekeep matchgen tx=0rename match idappend using "C:\tmp\t1.dta"sort idsave "C:\tmp\t2.dta",replaceclearuse chpt5_1, replacesort idmerge id using "C:\tmp\t2.dta"tab txdrop if tx==.save post12, replacetab married aodserv if p1 !=., chi2 rowtab high aodserv if p1 !=., chi2 rowtab bahigh aodserv if p1 !=., chi2 rowtab poverty2 aodserv if p1 !=., chi2 rowtab poverty3 aodserv if p1 !=., chi2 rowtab poverty4 aodserv if p1 !=., chi2 rowtab poverty5 aodserv if p1 !=., chi2 rowtab employ aodserv if p1 !=., chi2 rowtab open aodserv if p1 !=., chi2 rowtab black aodserv if p1 !=., chi2 rowtab hispanic aodserv if p1 !=., chi2 rowtab natam aodserv if p1 !=., chi2 rowtab chdage1 aodserv if p1 !=., chi2 rowtab chdage2 aodserv if p1 !=., chi2 rowtab chdage3 aodserv if p1 !=., chi2 rowtab cgrage1 aodserv if p1 !=., chi2 rowtab cgrage2 aodserv if p1 !=., chi2 rowtab cgrage3 aodserv if p1 !=., chi2 rowtab CRA47A aodserv if p1 !=., chi2 rowtab mental aodserv if p1 !=., chi2 rowtab arrest aodserv if p1 !=., chi2 rowtab PSH17A aodserv if p1 !=., chi2 rowtab sexual aodserv if p1 !=., chi2 rowtab provide aodserv if p1 !=., chi2 rowtab supervis aodserv if p1 !=., chi2 rowtab other aodserv if p1 !=., chi2 rowtab ra aodserv if p1 !=., chi2 rowtab cidi aodserv if p1 !=., chi2 rowtab cgneed aodserv if p1 !=., chi2 rowtab cwwrep aodserv if p1 !=., chi2 row//Kaplan-Meier and significance test of // difference on survivor function//Alluse svl_all, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxonsts graph, by (aodserv) saving(s_all.gph, replace) title ("Original Sample N=2,723")//Scheme 1use svl_1, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxon//Scheme 2use svl_2, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxon//Scheme 3use svl_3, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxon//Scheme 4use svl_4, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(10)sts test aodserv, wilcoxon//Scheme 5use svl_5, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxon//Scheme 6use svl_6, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxon//Scheme 7use svl_7, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxon//Scheme 8use svl_8, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxon//Scheme 9use svl_9, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxon//Scheme 10use svl_10, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts test aodserv, wilcoxon//Scheme 11use svl_11, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(10)sts test aodserv, wilcoxon//Scheme 12use svl_12, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(10)sts test aodserv, wilcoxon//Survivor curve for Scheme 9use svl_9, replacestset durm, failure(rrpt==1)stci, by (aodserv) p(15)sts graph, by (aodserv) saving(s_9.gph, replace) title ("Sample Based on Matching Scheme 9 N=482")log close________________________________________________________ ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download