MEIRU Microdata Portal
  • Home
  • Overview
  • Microdata Catalog
  • Citations
  • Login
    Login
    Home / Central Data Catalog / MWI-MEIRU-TB-COMBINE-FINAL-2022-V01 / variable [V2]
central

TB cases (1974-2018) and controls (1998-2018) analytical dataset (Karonga)

Malawi
Get Microdata
Reference ID
MWI-MEIRU-TB-COMBINE-FINAL-2022-v01
Producer(s)
Mia Crampin, Estelle McLean
Collections
Karonga -District-wide Combined / Harmonized Datasets Karonga HDSS
Metadata
Documentation in PDF DDI/XML JSON
Created on
Nov 14, 2025
Last modified
Nov 15, 2025
Page views
25145
Downloads
151
  • Study Description
  • Data Dictionary
  • Downloads
  • Get Microdata
  • Data files
  • combined_tb_cases_controls_final

whether person is a case or control (D) (case)

Data file: combined_tb_cases_controls_final

Overview

Valid: 12911
Invalid: 0
Type: Discrete
Decimal: 0
Start: 8
End: 8
Width: 1
Range: 0 - 1
Format: Numeric

Questions and instructions

Literal question
whether person is a case or controlwhether person is a case or control
Categories
Value Category Cases
0 Control 3820
29.6%
1 Case 9091
70.4%
Warning: these figures indicate the number of cases found in the data file. They cannot be interpreted as summary statistics of the population of interest.

Description

Definition
whether person is a case or control

Imputation and derivation

Derivation
Variable is created during appending of case/control datasets
<this is the code that put the datasets for the main file together, unless otherwise indicated, the code is working off this dataset>
**TBX (CASES)
use ${newstata}\tbold_tbpart2, clear
rename * *_2
rename ident_2 ident
save ${tempfiles}\tbold_tbpart2, replace
use ${newstata}\tbold_tbpart1, clear /*data prior to 2000*/
merge m:1 ident using ${tempfiles}\tbold_tbpart2
gen intdiff=abs(intdate_2-intdate)
bys ident: egen mindiff=min(intdiff)
gen keep=1 if mindiff==intdiff & _m==3
desc *_2, varlist
foreach var in `r(varlist)' {
cap replace `var'=. if keep~=1
cap replace `var'="" if keep~=1
}
gen case=1
rename occhead occheadold
save ${tempfiles}\tbold_tbpart12, replace

use ${newstata}\tb_tbxto2007, clear /*data from 2000 to 2007*/
gen case=1
save ${tempfiles}\tb_tbxto2007, replace

use ${newstata}\tb_tbx, clear /*data from 2007 onwards*/
gen case=1
save ${tempfiles}\tb_tbx, replace

**TBO (CONTROLS)
use ${newstata}\tbold_control, clear /*data prior to 2000*/
gen case=0
rename occhead occheadold
save ${tempfiles}\tbold_control, replace

use ${newstata}\tb_tboto2007, clear /*data from 2000 to 2007*/
gen case=0
save ${tempfiles}\tb_tboto2007, replace
use ${newstata}\tb_tbo, clear /*data from 2007 onwards*/
gen case=0
save ${tempfiles}\tb_tbo, replace

use ${tempfiles}\tbold_tbpart12, clear
append using ${tempfiles}\tb_tbxto2007
rename smeacult smeacult_old
append using ${tempfiles}\tb_tbx
duplicates drop ident intdate, force
preserve
use ${newstata}\tbcpu, clear
duplicates drop ident intdate, force
keep ident tbtype tbcpu mic_res outcome intdate starteps fineps pos_cult
rename (mic_res outcome) (mic_resH outcome_cpu)
save ${tempfiles}\tbcpu_edit, replace
restore
merge 1:1 ident intdate using ${tempfiles}\tbcpu_edit, keep(match) nogen
append using ${tempfiles}\tbold_control
append using ${tempfiles}\tb_tboto2007
append using ${tempfiles}\tb_tbo
bys ident intdate (mohregno): keep if _n==_N
*add in crshse from residency episodes
preserve
use ident startdate stopdate crshse using ${gendata}\crs_residency_episodes_clean_nopoly, clear
save ${tempfiles}\reseps, replace
restore
drop _m
joinby ident using ${tempfiles}\reseps, unmatched(master)
gen crs=1 if intdate>=startdate & intdate<stopdate
replace crshse="9999999" if crs~=1
bys ident intdate (crshse): keep if _n==1
replace crshse="" if crshse=="9999999"
drop startdate stopdate _m
save ${tempfiles}\comb_tbx_tbo, replace

la def case 0 "Control" 1 "Case"
la val case case

Others

Notes
case available from 1974 to 2018
Back to Catalog
MEIRU Microdata Portal

© MEIRU Microdata Portal | admin@meirudata.mw | All Rights Reserved | Register