AbstractIntroductionIn 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.MethodsWe 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.ResultsWe 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.).ConclusionThe 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.