Joseph Nathan Cohen

Department of Sociology, CUNY Queens College, New York, NY

Loading Stata Files

How to load a Stata-format data file into Stata

To see more about the “Teaching through YouTube” series.  For more, see this post.

Original Video Description

This video shows how to load Stata-format data.

Transcription (Auto-Generated)

Here’s the cleaned-up transcript: In this video, I’ll guide you on how to load Stata data files. It’s important to note that I’m focusing on loading files specifically formatted for Stata, not any other type of file. By the end of this tutorial, you’ll be proficient in loading a Stata-formatted dataset into Stata’s memory. To load Stata-formatted data files, follow these steps: Navigate to the command window in Stata. Type in the command: use “filename.dta”, clear For example, if you’re trying to load a file named “surveydata.dta”, you would enter: use “surveydata.dta”, clear It’s essential to ensure Stata is set to the appropriate working directory containing the data file you wish to access. Keep in mind that this command is exclusive to Stata-formatted data. It’s incompatible with data from other programs, such as Microsoft Excel. For a successful data load, you require two details: The path to the working directory The name of the Stata data file you aim to load To retrieve this information: Go to the folder containing your data. Copy the path from the address bar at the top of the window. Note the dataset’s name. Ensure you observe the name closely, as some dataset names might have spaces. To load the data: Set Stata’s directory to the one containing your data. Given that your dataset is named “data 1”, you would type: use “data 1.dta”, clear Upon executing this command, the data will be loaded into the computer’s memory. In summary: To open a Stata-formatted dataset, the syntax is: use “filename.dta”, clear. Ensure Stata points to the correct working directory, and the data is in Stata format. If you ever face challenges recalling these commands, simply type help use in the command window to access Stata’s help file.