Codebook command in Stata

May 09, 2019

The codebook command in Stata is useful for initial data exploration. Like tabulate or inspect it provides a quick overview of a dataset, including information on variable type (ie. numeric (byte, int, long, float, double) or string), label, unique values (the number of unique values that a variable could take, for intance number of catergories for categorical variables), missing values, and summary statistics (for numeric values values for mean, standard deviation and percentiles).

Let’s try it out:

sysuse nlsw88, clear
codebook

This will give you a detailed overview of all variables in the nlsw88 dataset. In order to see more information for a specific variable though, it’s as simple as:

codebook age 

Codebook example


Profile picture

Written by Johan Osterberg who lives and works in Gothenburg, Sweden as a developer specialized in e-commerce. Connect with me on Linkedin

2024 © Johan Osterberg