Member Training: Using Macros, Loops, and Functions in Stata to Manage Your Data Software Tutorial

Many data sets are challenging and time consuming to work with because the data are seldom in an optimal format.

This tutorial will show how to create a categorical variable from a series of dummy coded questions. In this tutorial we use the public data set “California Health Survey”. Often a survey data set is comprised of a series of dummy variables with a specific focus. Creating graphs and tables from a series of dummy variables is a difficult task.

Two methods for completing this task will be shown. This first method is a time consuming method that must be altered for every data set that you work with.

The second method incorporates macros, loops and functions that extract the variable labels from the dummy variables to use as labels for the new categorical variable. With only a few minor adjustments, this method can easily be repeated for any data set and for many data management tasks.

Note: This training is a benefit to members of the Statistically Speaking Membership Program and part of the Stat’s Amore Trainings Series.

Not a Member? Join!


About the Instructor

Jeff Meyer is a statistical consultant with The Analysis Factor, a stats mentor for Statistically Speaking membership, and a workshop instructor. Read more about Jeff here.

Not a Member Yet?
It’s never too early to set yourself up for successful analysis with support and training from expert statisticians. Just head over and sign up for Statistically Speaking.

You'll get access to this training webinar, 130+ other stats trainings, a pathway to work through the trainings that you need — plus the expert guidance you need to build statistical skill with live Q&A sessions and an ask-a-mentor forum.