Using StatTransfer to Get ASCII Data into Stata

If the computer you are using has the program StatTransfer on it, you can use it to convert your data into a Stata file. If you need access to StatTransfer, contact the UCI Social Science Data Librarian. When you open the StatTransfer program, a dialog box should appear. In the field labeled "Input File Type", choose the format that your dataset is in (e.g. Excel, SPSS). If you have tab-delimited (*.txt) or comma-separated (*.csv) data, choose "ASCII delimited" in this box - StatTransfer will automatically determine whether it is comma- or tab-delimited. In our example here, we are using a tab-delimited .txt file, so we will select "ASCII-Delimited" as the input-file type:



Click here for full-size image

In the "File Specification" box below it, browse for your data file that you want to transfer:



Click here for full-size image

In the "Output File Type" box, choose whatever version of Stata you are using (e.g. Stata (Standard) if you are using Intercooled, or Stata/SE 8 if you have the special edition version). In the "File Specification" box below it, the value will automatically fill in the name for your new file. By default, StatTransfer assigns the new file the same name as the original file but with a different extension (e.g. *.dta for Stata files). StatTransfer will save the new data in the same directory as the original data file. You can edit this file path if you would like to save it somewhere else on your computer.



Click here for full-size image

Click the "Transfer" button, and the dataset should appear in the specified output directory:



Click here for full-size image

If you use StatTransfer with an Excel file and use the "Excel" option in the "Input File Type" box, the variable names in the original file will generally carry over to the Stata dataset. If you use an ASCII format, you will have to -rename- the variables once the data are transferred into Stata format.


Other Means for Getting Data in Stata:

If you do not have the StatTransfer program, you can still use built-in features in Stata to read your data into Stata format:

Cutting and pasting data directly into Stata

Using Stata's -insheet- command

Using Stata's -infix- command

Converting ICPSR Data in ASCII Format into Stata Data Files





Data Analysis

Page adapted from Electronic Data Center, Emory University Libraries
Original text by Amy Yuen