Importing Data into Stata [see http://www.stata.com/support/faqs/data/newexcel.html for more.]
1. A rule to remember
Stata expects one matrix or table of data from one sheet, with at most one line of text at the start defining the contents of the columns.
2. How to get information from Excel into Stata
Using your Windows or Macintosh computer,
1. Start Excel.
2. Enter data in rows and columns or read in a previously saved file.
3. Highlight the data of interest, and then select Edit and click Copy.
4. Start Stata and open the Data Editor (type edit at the Stata dot prompt).
5. Paste data into editor by selecting Edit and clicking Paste.
3. insheet command
The following section is from material by James Hardin, University of South Carolina, and Ted Anagnoson, California State Los Angeles.
1. Launch Excel and read in your Excel file.
2. Save as a text file (tab delimited or comma delimited) by selecting File and clicking Save As. If the original filename is filename.xls, then save the file under the name filename.txt or filename.csv. (Use the Save as type listâspecifying an extension such as .txt is not sufficient to produce a text file.)
3. Quit Excel if you wish.
4. Launch Stata if it is not already running. (If Stata is already running, then either save or clear your current data.)
5. In Stata, type insheet using filename.ext, where filename.ext is the name of the file that you just saved in Excel. Give the complete filename, including the extension.
6. In Stata, type compress.
7. Save the data as a Stata dataset using the save
command.