Agriculture Reference
In-Depth Information
Stata uses a specific language syntax to invoke a command. This
syntax is common across all of Stata's commands and is explained
in the help files available through the Viewer window. Using the
insheet
using
command as an example, this command looks like
this in its help window:
insheet
[
varlist
]
using
filename
[,
options
]
Items without brackets are required so the command at the very
least would include
insheet
using
filename
. Items in brackets
are optional and may or may not be used. In the above command, the
varlist
changes the variable names in the imported file. Remember,
we changed the variable names from number, variety, etc. to no, var,
etc. in the dialog window. The comma is required if any options are to
be used. These options include such things as changing the file delim-
iter and data type, and maintaining name case, etc. For a more detailed
explanation of this command, open a Viewer window and type
help
insheet
in the Command field at the top of the window. This will
bring up the help file for this command. At the top right of the win-
dow is a drop-down menu Dialog where the
insheet
dialog can be
opened. This can be helpful if, for example, while looking through the
help files, you find a command you are interested in, but are unsure
how the command works. Select the drop-down item and the dialog
window will appear, which you can then fill out. The help information
listed in the Viewer window includes under which menu this particular
command is located. It will be listed under the Menu heading.
Some commands will have the first letter or two underlined; this
means that you can abbreviate that command by typing just that let-
ter or two. Look at the example below the
describe
command.
Notice how the
d
is underlined, which means this command could
be invoked by typing just the
d
in the command window. Some com-
mands require the entire command be typed. This is reserved for com-
mands that will change something that can't be undone. This helps
protect you from accidentally and irretrievably changing your data.
For example, the command
generate
that generates a new variable
can be entered with just
g
, while
replace
requires the entire word
be entered to avoid inadvertently replacing important data. It is still
possible to make mistakes, but this should help some. To see how
abbreviated commands work, try the below command with just
d
.
Search WWH ::
Custom Search