When preparing an Excel file for STATA, make sure that only the has letters. STATA will read the top row as the variable names, but a second row will be read as the first scores on the variables. Additionally, if you are going to read an Excel file into STATA, save the Excel file as both an Excel file and a “tab delimited text file.” The “tab delimited text file” is the file STATA will read.
: If sorting for a class, deleted the “names” column. Then highlight
the rest of the spreadsheet, click on “Data,” click on “Sort,” click on “Sort by” (choose the column you want the data sorted on the basis of – e.g., “ID”) and it should go from lowest to highest in the column you selected. If this doesn’t work, try what is written below.
to sort from, for example, lowest to highest scores in a column do the following: (1) put the column you wish to sort on the basis of in column “A” (i.e., furthest column to the left); (2) highlight column “A”; (3) click on heading entitled “Data”; (4) click on “Sort”; (5) choose sorting criteria (usually “lowest to highest” is the default option – i.e., to sort from lowest to highest you should be able to click on “OK” – YOU MAY NEED TO CHOOSE “EXPAND THE CURRENT SELECTION” – if it doesn’t work, check the option OTHER than “Expand the Current Selection”)
: Make sure that any “missing data” is
denoted with a period (“.”), which is Stata’s missing data code. Save the Excel file as a “tab delimited text” file to the “c” drive (the tab delimited option is in the lower part of the gray box that will appear when you save the file (clicking on “Save as” in the upper left corner). You do not need a file extension. Note: a gray box in the middle of the screen will say that the file is not saved as an Excel file. Click on “yes.” Go into Stata. In the command line type: set mem 5000k and press “enter.” In the command line type: insheet using “C:/senate1.txt” (you need the quotation marks and the txt on the end). Save as a Stata file by clicking in the upper left corner on “file” and then “save as” and make sure you remove the “*” and have .dta as a file extension. Thus to save as a file called senate you would need the file name box to read: senate.dta (no asterik).
: read the data file into Stata; click on
“Window” (top of the screen); click on “Data Editor”; click on upper left corner to highlight and keep highlighting as you move right; click on “Edit” (top of screen); click on “copy”(or control “c” – i.e., “Ctrl c”); then go into Excel and “paste” (or control “v” – i.e., “Ctrl v”). Check to see that dots (i.e., “.”) representing missing data are in the new Excel file. If not, follow
“Recoding and Missing Data” section ahead.