
Stata 8 has been updated so that it can identify and separate variables in data files without requiring the user to specify the separator used in the datasheet. Thus, the most basic method, cutting and pasting, will often work. Simply open your data in Excel and select (highlight) all cases and variables (columns). From the Edit menu, select copy (or use "ctrl+c" on the keyboard) to copy the data:

Click here for full-size image
Open Stata and choose the Data Editor, which is a spreadsheet-like interface in Stata for editing Stata files. You can
open the Data Editor through one of three means: (1) click on the icon in the top navigation
bar that looks like a tiny spreadsheet (the icon without without the magnifying glass), (2) type "edit" in the command
window, or (3) select the "Data" menu and choose "Data Editor" from the drop-down list of items. A blank spreadsheet will then
appear. Be sure you do not open the Data Browser because the browser does not allow you to edit data.

Click here for full-size image
Click here for full-size image
Select the cell in the first row and first column and select the "Edit" menu. Then, click "paste" (or type "ctrl+v"):

Click here for full-size image
The data will then appear in the Data Editor.

Click here for full-size image
Close the editor window, and a list of variable names will appear in the variables window:

Click here for full-size image
Sometimes Stata does not preserve the column names when you cut and paste
data into Stata. Instead, it may put them into the first row of data and then assign
its standard names to variables (e.g. var1, var2, var3). If this happens, you must rename each variable
(using the
-rename- command)
with its appropriate name.
After renaming all of your variables, you must delete the first row of the dataset to
separate the column names from the actual data. The syntax for renaming variables will be something like the following:
rename oldvariablename newvariablename
Example:
rename var1 series

Click here for full-size image
You will see the new variable names appear in the Stata Browser window.

Click here for full-size image
Once you've renamed your variables, you can use the
-drop-
command to delete the column headings in the actual datasheet. Remember that Stata has the "_n" system variable, which Stata
uses for identifying each row of data. So, you can an "if" conditional statement to tell Stata that you only want to drop those
rows where _n==1, i.e. to drop only the first row in the datafile. We can do this by entering the following command:
drop if _n==1

Click here for full-size image
(Note the use double equals signs in the "if" statement.)
When we open the browser window after entering the command, we now see that the first row of data containing the labels is
gone:

Click here for full-size image
More sophisticated methods for importing data into Stata eliminate the need to manually enter column names. These methods are
described here:
Using StatTransfer
Using Stata's -insheet- command
Using Stata's -infix- command
Converting ICPSR Data in ASCII Format into Stata
Data Files