South Africa - Treatment eligibility and retention in clinical HIV care: a regression-discontinuity study in South Africa. PLOS Medicine 2017
| Reference ID | Bor.PLoSMed.2017.Replication.Data |
| Year | 2011 - 2012 |
| Country | South Africa |
| Producer(s) |
Bor J* Fox MP Rosen S Venkataramani A Tanser F Pillay D Bärnighausen T |
| Collection(s) | |
| Metadata |
Documentation in PDF
|
Created on
Nov 09, 2017
Last modified
Nov 13, 2017
Page views
69923
Data Dictionary
| File | Description | Cases | Variables |
|---|---|---|---|
| S1_Data | This dataset is the replication data for: Bor J*, Fox MP, Rosen S, Venkataramani A, Tanser F, Pillay D, Bärnighausen T. Treatment eligibility and retention in clinical HIV care: a regression-discontinuity study in South Africa. PLOS Medicine 2017. Replication code is provided as supplementary information to the paper and can be downloaded from the PLOS Medicine website. This code contains both information on how the analytic dataset was created from the raw data, as well as the code for the analyses presented in the paper. The following is the Stata-SE 11.2 code used to generate the analytic dataset from the raw data on the Hlabisa HIV Treatment and Care Programme in the ARTemis database. Clinic names are suppressed to preserve confidentiality. *** Construction of Analytical Dataset for Bor et al. PLOS Med 2017 * Move these three raw data files to $filepath: * (1) "AH03-01 All patients in HIV Care/AH03-01 All patients in HIV Care.dta" * (2) "AH03-02 All Lab Tests/AH03-02 All Lab Tests.dta" * (3) "AH03-03 ART Clinic Visits/AH03-03 ART Clinic Visits.dta" global filepath = "/Users/jacobbor/Dropbox/RD350_retention" clear clear matrix clear mata set mem 150m set more off cd $filepath *** Extract patient-level data use "AH03-01 All patients in HIV Care/AH03-01 All patients in HIV Care.dta", clear foreach v of varlist DateOfBirth DateOfDeath DateOfInitiation DateOfEarliestCD4 DateLastFollowedUp LastClinicVisitDate DateLatestPCcollected DateLastPickedUpMedication DateOfLastWeightKgBeforeInit DateOfLastHeightCmBeforeInit DateOfLastHIVStagingChildrenBefo DateOfLastHIVStagingAdultsBefore DateRegdAtEarliestClinic ARTDateEligible ARTDateTrainingStarted DoctorsPrescriptionDate { local newvar = substr("`v'",1,25) rename `v' _`newvar' gen `v' = date(_`newvar',"YMD") format `v' %td drop _`newvar' } local variables "PersonNo ACDIS_IIntId HIS_PatientId DateOfBirth DateOfDeath Sex EarliestRegistrationClinic* CauseOfDeath Isigodi DateOfEarliestCD4Count EarliestCD4Count EarliestCD4Pct DateOfInitiation LastCD4DateBeforeInitiation LastCD4CountBeforeInitiation LastCD4PctBeforeInitiation IsTransferIn IsTransferinName CurrentFollowUpStatus CurrentFollowUpStatusName DateLastFollowedUp LastClinicVisitDate DateLatestPCcollected DateLastPickedUpMedication DateOfLastWeightKgBeforeInit LastWeightKgBeforeInit DateOfLastHeightCmBeforeInit LastHeightCmBeforeInit DateOfLastHIVStagingChildrenBefo LastHIVStagingChildrenBeforeInit DateOfLastHIVStagingAdultsBefore LastHIVStagingAdultsBeforeInit DateRegdAtEarliestClinic DateOfEarliestCD4 ARTDateEligible ARTDateTrainingStarted DateOfInitiation DoctorsPrescriptionDate ARTDaysEligibleToInitiation DisclosedHIVStatusToAnyone" local variables "PersonNo DateOfBirth Sex EarliestRegistrationClinicName DateOfEarliestCD4Count EarliestCD4Count DateOfInitiation" keep `variables' order `variables' *** Recode variables gen female = Sex == "F" replace female = . if Sex == "U" gen age = (DateOfEarliestCD4 - DateOfBirth) / 365.24 egen agecat = cut(age), at(0,18,25,30,35,40,45,55,999) /* for public use data */ gen QtrOfEarliestCD4Count = qofd(DateOfEarliestCD4Count) /* for public use data */ format QtrOfEarliestCD4Count %tq gen Clinic_A = EarliestRegistrationClinicName == "SUPPRESSED" gen Clinic_B = EarliestRegistrationClinicName == "SUPPRESSED" gen Clinic_C = EarliestRegistrationClinicName == "SUPPRESSED" gen Clinic_Other = (1-Clinic_A)*(1-Clinic_B)*(1-Clinic_C) *** Limit data to study population * Exclusions count drop if DateOfEarliestCD4 == . drop if EarliestCD4Count == . drop if DateOfEarliestCD4 < td(12aug2011) drop if DateOfEarliestCD4 >= td(1jan2013) /* ensure at least one year of potential follow-up for all patients (follow up ends Jan2014)*/ count if DateOfEarliestCD4 > DateOfInitiation local N_drop = r(N) drop if DateOfEarliestCD4 > DateOfInitiation count dis `N_drop'/(`N_drop' + r(N)) save "temp Hlabisa350 patients.dta", replace *** Bring in labs and clinic visits data * Extract routine clinic visits (labeled as "TestDate") use "AH03-03 ART Clinic Visits/AH03-03 ART Clinic Visits.dta", clear keep if VisitType ==8 keep PersonNo VisitDate rename VisitDate _VisitDate gen VisitDate = date(_VisitDate,"YMD") format VisitDate %td drop _VisitDate * Now, bring in routine labs data append using "AH03-02 All Lab Tests/AH03-02 All Lab Tests.dta", keep(PersonNo TestDate ViralLoad ViralLoadBelowLDL CD4Count) * drop lab tests that were not CD4/VL tests keep if ViralLoad < . | CD4Count < . | VisitDate < . keep PersonNo VisitDate TestDate * merge back into patient-level data merge m:1 PersonNo using "temp Hlabisa350 patients.dta" keep if _merge ==3 drop _merge rename TestDate _TestDate gen TestDate = date(_TestDate ,"YMD") format TestDate %td drop _TestDate * include DatesOfInitiation as a "testdate" gen TestOrVisitDate = TestDate replace TestOrVisitDate = VisitDate if TestDate ==. sort PersonNo TestOrVisitDate by PersonNo: gen rank = _n expand 2 if rank ==1, gen(new) replace TestDate = . if new ==1 replace VisitDate = . if new ==1 replace TestDate = DateOfInitiation if new == 1 replace TestOrVisitDate = DateOfInitiation if new == 1 sort PersonNo TestOrVisitDate drop new *** Define ART Initiation Outcomes cap drop ART_* gen ART_2w = 0 replace ART_2w = 1 if DateOfInitiation < DateOfEarliestCD4Count + 14 gen ART_6m = 0 replace ART_6m = 1 if DateOfInitiation < DateOfEarliestCD4Count + 182 gen ART_12m = 0 replace ART_12m = 1 if DateOfInitiation < DateOfEarliestCD4Count + 365 *** Define Retention in Care Outcomes * Note: for followup out to 18 and 24 mo, restrict sample to people presenting with at least 18 (or 24) mo follow-up sort PersonNo TestOrVisitDate * define main outcome - retention at 12mo (6-18), including routine clinic visits gen _visit_test_6_18 = TestOrVisitDate > DateOfEarliestCD4Count + 182 & TestOrVisitDate < DateOfEarliestCD4Count + 365 + 182 by PersonNo: egen visit_test_6_18 = max(_visit_test_6_18) by PersonNo: replace visit_test_6_18 = . if _n>1 replace visit_test_6_18 = . if DateOfEarliestCD4Count + 365 +182 > td(1jan2014) * alternate definition, without clinic visits gen _test_6_18 = TestDate > DateOfEarliestCD4Count + 182 & TestDate < DateOfEarliestCD4Count + 365 + 182 by PersonNo: egen test_6_18 = max(_test_6_18) by PersonNo: replace test_6_18 = . if _n>1 replace test_6_18 = . if DateOfEarliestCD4Count + 365 +182 > td(1jan2014) * time-path of retention, w/o clinic visits gen _test_0_6 = TestDate > DateOfEarliestCD4Count + 0 & TestDate < DateOfEarliestCD4Count + 182 by PersonNo: egen test_0_6 = max(_test_0_6) by PersonNo: replace test_0_6 = . if _n>1 gen _test_6_12 = TestDate > DateOfEarliestCD4Count + 182 & TestDate < DateOfEarliestCD4Count + 365 by PersonNo: egen test_6_12 = max(_test_6_12) by PersonNo: replace test_6_12 = . if _n>1 gen _test_12_18 = TestDate > DateOfEarliestCD4Count + 365 & TestDate < DateOfEarliestCD4Count + 365 + 182 by PersonNo: egen test_12_18 = max(_test_12_18) by PersonNo: replace test_12_18 = . if _n>1 replace test_12_18 = . if DateOfEarliestCD4Count + 365 +182 > td(1jan2014) gen _test_18_24 = TestDate > DateOfEarliestCD4Count + 365 + 182 & TestDate < DateOfEarliestCD4Count + 365 + 365 by PersonNo: egen test_18_24 = max(_test_18_24) by PersonNo: replace test_18_24 = . if _n>1 replace test_18_24 = . if DateOfEarliestCD4Count + 365 +365 > td(1jan2014) * keep only the first obs per patient, so that the dataset is at the level of the patient, not the lab test by PersonNo: keep if _n==1 count if test_6_18 < . count if visit_test_6_18 <. tab test_6_18 visit_test_6_18 *** Drop identifying information for public use data (and extraneous variables) drop _* rank DateOfEarliestCD4Count DateOfInitiation PersonNo VisitDate TestDate TestOrVisitDate DateOfBirth age Sex EarliestRegistrationClinicName order EarliestCD4Count QtrOfEarliestCD4Count female agecat Clinic_A Clinic_B Clinic_C Clinic_Other ART_2w ART_6m ART_12m visit_test_6_18 test_6_18 test_* *** Label variables label var EarliestCD4Count "Value of Earliest CD4 Count, cells per mm3" label var QtrOfEarliestCD4Count "Quarter of Earliest CD4 Count (exact date suppressed)" label var female "Female" label var agecat "Age category (exact age suppressed)" label var Clinic_A "Entered care at Clinic A" label var Clinic_B "Entered care at Clinic B" label var Clinic_C "Entered care at Clinic C" label var Clinic_Other "Entered care at a clinic other than A, B, or C" label var ART_2w "Started ART within 2 weeks of earliest CD4 count" label var ART_6m "Started ART within 6 months of earliest CD4 count" label var ART_12m "Started ART within 12 months of earliest CD4 count" label var visit_test_6_18 "Retained at 12 months; any labs or clinic visits 6-18 mo after earliest CD4" label var test_6_18 "Retained at 12 months; any lab tests 6-18 months after earliest CD4" label var test_0_6 "Retained 0-6 months; any lab tests 0-6 months after earliest CD4" label var test_6_12 "Retained 6-12 months; any lab tests 6-12 months after earliest CD4" label var test_12_18 "Retained 12-18 months; any lab tests 12-18 months after earliest CD4" label var test_18_24 "Retained 18-24 months; any lab tests 18-24 months after earliest CD4" label define agecat 0 "0 to <18 yrs" label define agecat 18 "18 to <25 yrs", add label define agecat 25 "25 to <30 yrs", add label define agecat 30 "30 to <35 yrs", add label define agecat 35 "35 to <40 yrs", add label define agecat 40 "40 to <45 yrs", add label define agecat 45 "45 to <55 yrs", add label define agecat 55 "55+ yrs", add label values agecat agecat save "S1_Data.dta", replace | 11306 | 17 |
Documentation in PDF