Stata Help

Getting Descriptives in Stata

Like many things in Stata, there is no single right way to get the program to display descriptives. Below, we will explore two methods. The first of these is the summarize command and the second is tabstat.

To obtain the most basic descriptives (N, mean, std. deviation, min and max) the command is simply summarize [varname(s)] if you do not specify a variable, Stata will print them all. The format for summarize is a list:

Screenshot of a data set.

One particularly useful options for summarize is the , detail option. Telling Stata to summarize, detail yields a wealth of information.

Screenshot of a summarized data set in Stata.

The summarize command cannot be split using by, so it will not summarize things by a category, thus you may want to use tabstat to get descriptives split by gender or gender and grade. The tabstat command is one of the rare cases where it is probably best and certainly fastest to use the menu. Therefore, go to Statistics => Summaries, Tables, and Tests => Other tables => Compact table of summary statistics.

Note: There are two similar options under the Other tables menu, make sure you select the first one (compact, not flexible).

Selecting Compact table of summary statistics brings up the tabstat menu. Use the first drop-down menu to select a variable to summarize. The menu immediately under it allows you to select a grouping variable when the box next to  itis checked. Finally, at the bottom is a series of drop-down menus with a variety of other statistics available. Check a box to activate a menu, and select your statistic of choice. All of the statistics that you select will be displayed in a single table.

Screenshot of a tabstat menu in Stata.

Additionally, the by/if/in tab will repeat the command for additional categorical variables (by) or allow you to only run the command on cases satisfying some condition (if) using a range of observations (in). The Weights tab is for cases where the data is weighted. Finally, the Options tab allows you to change the appearance of the table and save the list of summary statistics. Execute the command by clicking OK.

Once you have submitted the command, it will appear in the Review window. You can always click on it again to place it back in the Command window, change the options, and resubmit it. Using the menu even once can be a great way to get a feel for this command's syntax.

Back