How el-bid/armonizacion_microdatos_encuestas_hogares_scl works
1. What this repository is
- This is not an application runtime; it is a Stata-based ETL/codebase for harmonizing household survey microdata across Latin America and the Caribbean.
- The main output is one standardized microdata file per country-year/round, designed to be comparable across time and across countries.
2. Top-level architectural boundary
- The repository is organized first by country ISO code and then by survey family.
- Each survey family is a separate transformation pipeline because the source questionnaires, file layouts, and naming conventions differ by country and by survey round.
3. Core processing units
- Inside each .../program folder there are typically two active scripts per round:
- *_mergeBID.do: combines source modules and, in some cases, multiple months/trimesters into a single working dataset.
- *_variablesBID.do: creates the harmonized variables from that merged dataset.
- These two scripts are the primary transformation stages in the repo.
4. Data flow through the pipeline
- The flow is generally:
- national survey source files/modules
- country-specific merge routine
- one consolidated working file
- standardized variable construction
- harmonized microdata dataset
- The README indicates that intermediate merged datasets are written outside the repo to the IDB survey share, \\sdssrv03\surveys.
5. Shared orchestration and cross-cutting logic
- _DOCS contains repo-wide support scripts rather than country pipelines.
- The most important ones are:
- CorreDoFilesArmonizacion.do: orchestrates running harmonization across countries.
- Labels&ExternalVars_Harmonized_DataBank.do: applies shared post-processing such as labels and external inputs.
6. External dependencies and data interfaces
- The repo depends on a local Stata setup and a user-specific profile.do in Stata’s PERSONAL directory to define paths like the Git root and survey storage root.
- The harmonization scripts are therefore tied to local execution context, not a containerized or server-hosted environment.
- The main external storage boundary is the shared survey server; the companion repo for indicators is a downstream consumer of the harmonized microdata.
7. Country/survey heterogeneity as a design feature
- The structure reflects many survey programs: labor force surveys, household income/expenditure surveys, living standards surveys, etc.
- Some countries have several survey families under the same country folder, and some rounds have special-case scripts, renamed files, or multi-stage merges, which indicates the pipelines are intentionally customized rather than generic.
8. Legacy and compatibility layers
- Many folders contain bak.stunicode, OLD, _old, or version-suffixed scripts.
- These are archival/compatibility copies of prior transformations, showing that the repository preserves historical logic for older survey rounds while newer scripts remain alongside them.
9. Specialized subpipelines
- A few areas go beyond the simple merge/variables pattern:
- Z_LAC_Ingreso_Gasto contains income/expenditure survey harmonization scripts across multiple countries.
- Some country folders include deeper helper scripts for module-specific handling, data reshaping, or survey-round exceptions.
- These are still Stata pipelines, but with more granular preprocessing steps.
10. Repository-level purpose for diagramming
- The key diagram should show a many-to-one structure: many country/survey-specific ingestion pipelines feeding a common harmonization standard.
- The main shared boundary is between:
- source-specific survey files and merge logic on one side
- standardized variable generation, labels, and external adjustments on the other
- The output is a harmonized microdata bank that is later used by a separate indicators repository.
11. Operational workflow
- The README defines a branching model with master, development, and feature branches, but this is a governance workflow rather than runtime architecture.
- It matters because harmonization changes are expected to be reviewed centrally before landing in the stable branch used for production runs.
12. What is intentionally not in the repo
- The repository does not store the raw survey source data itself.
- It also does not compute final indicators; that work is explicitly delegated to the separate indicators repository.
- This repo is therefore the microdata harmonization layer in the overall ecosystem.
Main entry points: CorreDoFilesArmonizacion.do Run all · ARG_2022s2_mergeBID.do ARG merge · ARG_2003m5_mergeBID.do ARG labor merge · BRA_POF_2008-2009.do LAC spending
Components 23
Shared orchestration
Repo-wide Stata automation, labeling, and documentation support.
- Run all · Central script for running harmonization across countries.
_DOCS/CorreDoFilesArmonizacion.do - Post-process · Applies shared labels and external variables after harmonization.
_DOCS/Labels&ExternalVars_Harmonized_DataBank.do - Template · Representative harmonization template used in documentation/support.
_DOCS/DOfile_MODELO.do - Paths · Defines repository and survey directory conventions for local runs.
_DOCS/Directorio HS LAC.do
Country pipelines
Country- and survey-specific harmonization pipelines.
- ARG merge · EPHC source-module and period consolidation for Argentina.
ARG/EPHC/program/ARG_2022s2_mergeBID.do - ARG vars · Builds standardized EPHC variables from merged Argentina data.
ARG/EPHC/program/ARG_2022s2_variablesBID.do - ARG labor merge · Labor-force source consolidation for Argentina EPHP.
ARG/EPHP/program/ARG_2003m5_mergeBID.do - ARG labor vars · Creates harmonized labor variables for Argentina EPHP.
ARG/EPHP/program/ARG_2003m5_variablesBID.do - PNADC · Brazil continuous household survey pipeline with annual and quarterly rounds.
BRA/PNADC/program/BRA_2022a_variablesBID.do - PME · Brazil monthly labor survey harmonization, including auxiliary subflows.
BRA/PME/program/BRA_2001a_variablesBID.do - GEIH · Colombia labor survey pipeline with specialized multi-module merges.
COL/GEIH/program/COL_2021t3_variablesBID.do - ECH · Older Colombia household survey harmonization family.
COL/ECH/program/COL_2005t3_variablesBID.do - ENAHO · Costa Rica household survey harmonization pipeline.
CRI/ENAHO/program/CRI_2022m7_variablesBID.do - EPHPM · Honduras household survey pipeline with legacy MDG-related extras.
HND/EPHPM/program/HND_2019m6_variablesBID.do - ENOE · Mexico labor-force survey harmonization across quarterly rounds.
MEX/ENOE/program/MEX_2019t2_variablesBID.do - ENAHO · Peru household survey pipeline with annual harmonization rounds.
PER/ENAHO/program/PER_2022a_variablesBID.do - ECH · Uruguay household survey harmonization family.
URY/ECH/program/URY_2022a_variablesBID.do - EHM · Venezuela household survey harmonization pipeline.
VEN/EHM/program/VEN_2015s2_variablesBID.do
Income & expenditure
Cross-country specialized consumption/income harmonization area.
- LAC spending · Cross-country income and expenditure harmonization area.
Z_LAC_Ingreso_Gasto/BRA/POF/program/BRA_POF_2008-2009.do
External interfaces
Local Stata setup and survey-storage boundary outside the repository.
- Microdata bank · Standardized comparable household microdata used downstream.
- Survey share · Intermediate working datasets and shared survey storage outside the repo.
- Stata profile · User-specific Stata PERSONAL profile that defines local paths.
- Indicators repo · Separate repository that consumes harmonized microdata to compute indicators.
Connections 28
- Paths → Stata profile: uses paths · Local path resolution depends on user Stata configuration.
- Run all → ARG merge: runs · Coordinates country harmonization jobs.
- Run all → PNADC: runs · Coordinates country harmonization jobs.
- Run all → GEIH: runs · Coordinates country harmonization jobs.
- Run all → ENAHO: runs · Coordinates country harmonization jobs.
- Run all → ENOE: runs · Coordinates country harmonization jobs.
- Run all → ENAHO: runs · Coordinates country harmonization jobs.
- Run all → EHM: runs · Coordinates country harmonization jobs.
- ARG merge → Survey share: writes temp · Merged working files are written to shared survey storage.
- ARG merge → ARG vars: feeds · Merged survey data becomes input to harmonized variable construction.
- ARG vars → Microdata bank: publishes · Produces standardized microdata for downstream use.
- ARG labor merge → Survey share: writes temp · Merged working files are written outside the repo.
- ARG labor merge → ARG labor vars: feeds · Merged labor data becomes input to harmonized variable construction.
- ARG labor vars → Microdata bank: publishes · Produces standardized labor microdata.
- PNADC → Survey share: writes temp · Intermediate merged datasets are stored externally.
- PME → Survey share: writes temp · Intermediate merged datasets are stored externally.
- GEIH → Survey share: writes temp · Specialized multi-module merges land in shared storage.
- ECH → Survey share: writes temp · Survey-family processing uses external working storage.
- ENAHO → Survey share: writes temp · Intermediate files are held outside the repository.
- EPHPM → Survey share: writes temp · Intermediate files are held outside the repository.
- ENOE → Survey share: writes temp · Intermediate files are held outside the repository.
- ENAHO → Survey share: writes temp · Intermediate files are held outside the repository.
- ECH → Survey share: writes temp · Intermediate files are held outside the repository.
- EHM → Survey share: writes temp · Intermediate files are held outside the repository.
- Post-process → Microdata bank: refines · Applies shared labels and external inputs to the harmonized bank.
- LAC spending → Survey share: writes temp · Specialized income/expenditure harmonization also uses external working storage.
- LAC spending → Microdata bank: publishes · Contributes specialized harmonized microdata to the bank.
- Microdata bank → Indicators repo: consumed by · Downstream indicators repository consumes harmonized microdata.