Agriculture Reference
In-Depth Information
2
D ata e ntry
Surprisingly, data entry and manipulation can be one of the most time-
consuming parts of statistical analyses. In some cases, the actual statis-
tical analyses may be inconsequential compared to the work of getting
data into the program in the right format. This can be particularly prob-
lematic if you are getting data you didn't create. A colleague or official
government source may give you data in a form that must be manipu-
lated in some significant way prior to analysis. Stata offers a wealth of
commands for just such purposes that can make quick work of the most
intractable dataset. In fact, there is a reference manual devoted to the
subject, called Data Management * from Stata Corporation.
Data in Stata is handled in a spreadsheet format with columns as
variables or identifiers and rows as observations. The easiest way to
enter data directly into Stata is with the Data Editor. In TableĀ 2.1 is a
small piece of data. Try entering it in the Data Editor. If you double
click on the gray cells at the top of an empty column, a dialog box
appears letting you name the variable and set some parameters associ-
ated with it.
You can enter data and the Data Editor will give the column a
generic name such as var1 (FigureĀ 2.1). The name must be 1-32 char-
acters long and begin with a letter or underscore. In addition, it can-
not have any spaces. The column can be labeled with a word or phrase
up to 80 characters long and can be used to give a fuller explanation
of what that variable is.
The Properties Region includes information about the file and data
and how the data will appear. The %9.0g is a format command. The
% indicates it is a format. The 9.0g indicates the field width is nine
characters wide and the .0 tells Stata to display as many decimals as
were entered. The g indicates that the format is a general format. If
you can't see all of your entry in the Data Editor, enter a larger num-
ber, such as 15.0g, to increase the width of the variable column. There
* Stata Press, 2011. Data Management. College Station: Texas.
29
Search WWH ::




Custom Search