Skip to Main Content

Stata

A brief introduction to Stata

Ways to View Data in Stata

Stata designates a separate ‘data window’ that can be opened once data is either downloaded or inputted manually. The data window has the name of the dataset on the very top left corner to let you know what dataset you are working with, if there are multiple open.

To view data in Stata on a separate window you may click on the data browser icon that is highlighted in red below. This will open a new window for browsing through data and some options specific to manipulating the data.

 

undefined

There are multiple options to view data in Stata. You may open a designated data window to view the data or call on Stata to show it in the output window. 

Below is the code for viewing an entire data set in the Stata output window.

Code

list

 

We simply tell Stata to list the data in the output window.

Output

The output for the code above is the observations listed in rows and variables as columns. Since there are so many observations in this dataset the output is longer than Stata is able to show. This is a limitation of 'listing' the data in Stata and instead using the data window or using other list functions maybe more useful. 

 

 

Note: a " . " in Stata indicates a missing datum point. 

To view a certain number of observations using the list function, we can specify the number using the code below. 

Code

First 10 observations

list in 1/10, table

 

Output

 

Code

Observations 15 to 20 

list in 15/20, table

 

Output 

 

In Stata we can learn more about how each variable is coded, the labels, and the format of the variable (e.g., numeric, string, or character). Below is the code for finding information for all variables in the dataset at once

Code

codebook

 

This is the command codebook for all the variables.

Below is the code to call on the codebook of only the variable language.

Code

codebook language

 

This is the command codebook for the variable language

Output