EUVIMEDEUVIMED entdecken
Open Access

A reproducible R workflow to preserve variable and value labels in Stata, SPSS, and SAS datasets for transparent and reproducible health research

Wingston Felix Ng'ambi, Adamson Sinjani Muula

Malawi Medical Journal · 04.09.2025 · 37 (3) · 193-206

DOI: 10.4314/mmj.v37i3.10 ↗

Kurz gefasst

Fachartikel in der Zeitschrift Malawi Medical Journal, online erschienen am 04.09.2025. Verfasst von Wingston Felix Ng'ambi und 1 weiteren Autor:innen. Beteiligte Einrichtung: Health Economics and Policy Unit, Department of Health Systems and Policy, Kamuzu University of Health Sciences, Lilongwe, Malawi. Hauptthemen laut MEDLINE: Workflow, Health Surveys, Software. Die Arbeit wurde bisher 15-mal zitiert (Crossref). Der Volltext ist frei in PubMed Central verfügbar.

AbstractSchlagwörterBibliografische AngabenZitierenVerwandte Studien

Abstract (Originalsprache)

Introduction

Large-scale health surveys like the Demographic and Health Surveys (DHS) and WHO STEPS are essential for tracking health trends and guiding policies in low- and middle-income countries. However, when these datasets are imported into tools like R, they often lose crucial metadata, variable and value labels, turning clear categories into cryptic codes. This slows analysis, risks errors, and weakens data reuse.

Methods

We developed a reproducible workflow in R to import and process survey data while preserving variable and value labels. Using open-source packages such as haven, labelled, and tidyverse, we automated reading of datasets, extraction of metadata, replacement of codes with readable labels, and renaming of variables with full descriptions. The workflow was designed to be modular, easy to adapt, and accessible for analysts with basic R skills.

Results

We tested the workflow on the contraceptive use module from the 2015/16 Malawi DHS and the tobacco use module from Malawi’s Global Youth Tobacco Survey. Without our process, variables appeared as vague codes (e.g., v312) and responses as plain numbers. After applying our workflow, these were transformed into clear, labelled categories like “Injectable” or “Never Married.” Frequency tables generated from the cleaned data were easier to interpret and share. This automated approach saved several hours of manual recoding and reduced the risk of errors.

Conclusion

By maintaining metadata, our workflow improves transparency, reproducibility, and efficiency in digital health research. This supports better training, clearer communication, and more reliable use of health data for policy and program decisions.

Schlagwörter

MeSH-Schlagwörter (MEDLINE)

WorkflowHealth SurveysSoftwareHumansReproducibility of ResultsMalawiFemale

Stichwörter der Autor:innen

data harmonisationdigital healthhealth surveysmetadata preservationreproducible research

Autor:innen und Institutionen

  • Health Economics and Policy Unit, Department of Health Systems and Policy, Kamuzu University of Health Sciences, Lilongwe, Malawi.
  • Africa Centre of Excellence in Public Health and Herbal Medicine (ACEPHEM), Kamuzu University of Health Sciences, Blantyre, Malawi.
  • Department of Community and Environmental Health, School of Global and Public Health.
  • ECSA College of Public Health Physicians, Arusha, Tanzania.

Zitieren

APA

Ng'ambi, W. F., & Muula, A. S. (2025). A reproducible R workflow to preserve variable and value labels in Stata, SPSS, and SAS datasets for transparent and reproducible health research. Malawi Medical Journal, 37(3), 193-206. https://doi.org/10.4314/mmj.v37i3.10

Vancouver

Ng'ambi WF, Muula AS. A reproducible R workflow to preserve variable and value labels in Stata, SPSS, and SAS datasets for transparent and reproducible health research. Malawi Medical Journal. 2025;37(3):193-206. doi:10.4314/mmj.v37i3.10

BibTeX
@article{Ngambi2025,
  author = {Ng'ambi, Wingston Felix and Muula, Adamson Sinjani},
  title = {A reproducible R workflow to preserve variable and value labels in Stata, SPSS, and SAS datasets for transparent and reproducible health research},
  journal = {Malawi Medical Journal},
  year = {2025},
  volume = {37},
  number = {3},
  pages = {193--206},
  doi = {10.4314/mmj.v37i3.10}
}
Kostenlos starten →