help input
-------------------------------------------------------------------------------
Title
[D] input -- Enter data from keyboard
Syntax
input [varlist] [, automatic label]
Description
input allows you to type data directly into the dataset in memory. See
also [D] edit for a windowed alternative to input.
Options
automatic causes Stata to create value labels from the nonnumeric data it
encounters. It also automatically widens the display format to fit
the longest label. Specifying automatic implies label, even if you
do not explicitly type the label option.
label allows you to type the labels (strings) instead of the numeric
values for variables associated with value labels. New value labels
are not automatically created unless automatic is specified.
Examples
---------------------------------------------------------------------------
Setup
. clear all
Enter data on accident rates and speed limits directly into Stata
. input acc_rate spdlimit
acc_rate spdlimit
1. 4.58 55
2. 1.86 60
3. 1.61 .
4. end
List the data
. list
Add another observation
. input
acc_rate spdlimit
4. 3.02 60
5. end
List the data
. list
Add another variable
. input acc_pts
acc_pts
1. 4.6
2. 4.4
3. 2.2
4. 4.7
List the data
. list
---------------------------------------------------------------------------
Setup
. clear all
Enter data directly into Stata, where name and sex are string variables
. input str20 name age str6 sex
name age sex
1. "A. Doyle" 22 male
2. "Mary Hope" 37 "female"
3. "Guy Fawkes" 48 male
4. end
List the data
. list
---------------------------------------------------------------------------
Setup
. clear all
Same as previous example, but store age as a byte
. input str20 name byte age str6 sex
---------------------------------------------------------------------------
Setup
. clear all
Enter data directly into Stata and store make as a str20, foreign and
rep78 as bytes, and price as the default float storage type
. input str20 make byte(foreign rep78) price
---------------------------------------------------------------------------
Also see
Manual: [D] input
Help: [D] edit, [D] infile, [D] save