%svy_freqs: A generic SAS macro for cross-tabulation between a factor and a by-group variable given a third variable and creating publication-quality tables using data from complex surveys
Jacques MuthusiiD, Samuel Musili MwaliliiD, Peter Wesley YoungiD
Abstract
IntroductionIn epidemiological studies, cross-tabulations are a simple but important tool for understanding the distribution of socio-demographic characteristics among study participants. They become more useful when comparisons are presented using a by-group variable such as key demographic characteristic or an outcome status; for instance, sex or the presence or absence of a disease status. Most available statistical analysis software can easily perform cross-tabulations, however, output from these must be processed further to make it readily available for review and use in a publication. In addition, performing three-way cross-tabulations of complex survey data such as those required to show the distribution of disease prevalence across multiple factors and a by-group variable is not easily implemented directly using available standard procedures of commonly used statistical software.\n\nMethodsWe developed a generic SAS macro, %svy_freqs, to create quality publication-ready tables from cross-tabulations between a factor and a by-group variable given a third variable using survey or non-survey data. The SAS macro also performs classical two-way cross-tabulations and refines output into publication-quality tables. It provides extra features not available in existing procedures such as ability to incorporate parameters for survey design and replication-based variance estimation methods, performing validation checks for input parameters, transparently formatting character variable values into numeric ones and allowing for generalizability.\n\nResultsWe demonstrate the application of the SAS macro in the analysis of data from the 2013-2014 National Health and Nutrition Examination Survey (NHANES), a complex survey designed to assess the health and nutritional status of adults and children in the United States (U.S.).\n\nConclusionThe SAS code use to develop the macro is simple yet comprehensive, easy to follow, straightforward for the end user and simple for a SAS programmer to extend. The SAS macro has shown to shorten turn-around time for statistical analysis, eliminate errors when preparing output, and support reproducible research.
02 /Specification & Classification
Click any tag to browse matching papers- Citations
- 0
- Research Focus
- Approach
Reproducibility ledger
Nobody has reported trying to reproduce this paper yet. Did you replicate an experiment or run the code? Your report saves the next lab a week.
Sign in to file a reproducibility report.
Related papers
- %svy_logistic_regression: A generic SAS(R) macro for simple and multiple logistic regression and creating quality publication-ready tables using survey or non-survey data
Jacques Muthusi, Samuel Musili Mwalili, Peter Wesley Young·PLoS ONEPeer-reviewed·Sep 3, 2019
- TernTables: A Statistical Analysis and Table Generation Web Interface for Clinical and Biomedical Research
Joshua D. Preston, Helen Abadiotakis, … Joshua L. Chan·bioRxiv·Apr 20, 2026
- PlotsOfData - a web app for visualizing data together with its summaries
M. Postma, J. Goedhart·bioRxiv·Nov 13, 2018
- Calculation of a distribution free estimate of effect size and confidence intervals using VBA/Excel
Joachim Goedhart·bioRxiv·Sep 10, 2016
- A Novel Workflow for Health Survey Analysis: Results on the Yazd Health Study (YaHS)
Elyas Heidari, Vahid Balazadeh Meresht, … M Sadr Bafghi·bioRxiv·Dec 10, 2018
- Datavzrd: Rapid programming- and maintenance-free interactive visualization and communication of tabular data
F. Wiegand, David Laehnemann, … Johannes Köster·PLoS ONEPeer-reviewed·Jul 22, 2025