Importing Data from Excel to Stata
Option 1: Using Copy and Paste If you have a small dataset, the easiest way to import Excel data into Stata is to copy from Excel and paste into Stata. Simply follow the steps below:
- Open your Excel spreadsheet
- Starting with the first row, which contains your variable names select the cells you wish to import into Stata.
- Right click or select the copy function and copy your selection.
- Open Stata.
- From the menu, select Data then Data Editor
- Click the first cell in the empty Data Editor and select paste.
The import option can be used to read in data saved as text, either by Excel or other programs. First, open your file in Excel and select Save as. (If you are using Office 2007, the option is Save as Excel binary.) Scroll down the drop-down menu and select text (tab-delimited) as the file type.
Next, open Stata. From the File menu select Import and from the options, select ASCII data created by a spreadsheet. The window shown below will appear.
Click the Browse button at right. There is no need to change any of the options from the default, nor to enter new variable names. Variable names will be imported along with your data.
When you click the browse button, a new window will appear, shown below.
NOTE:The default for data type is raw, change this by scrolling down to select Text files(*.txt). Now, select your file, click on the Open button. This brings you back to the previous window. Click OK. Your data are now in Stata.
Last updated:
December 03, 2008