A Brief Description of Stata: File Example Datasets..
A Brief Description of Stata: File Example Datasets..
We select Data > Describe data > Summary statistics and choose to summarize variables low,
age, and smoke, whose names we obtained from the Variables window. We click on OK.
1
2 [ U ] 2 A brief description of Stata
Stata shows us the command that we could have typed in command mode—summarize low age
smoke—before displaying the results of our request.
Next we fit a logistic regression model of low on age and smoke. We select Statistics > Binary
outcomes > Logistic regression (reporting odds ratios), fill in the fields, and click on OK.
. use http://www.stata-press.com/data/r13/auto
(1978 Automobile Data)
. summarize mpg weight
Variable Obs Mean Std. Dev. Min Max
The user typed summarize mpg weight and Stata responded with a table of summary statistics.
Other commands would produce different results:
. generate gp100m = 100/mpg
. label var gp100m "Gallons per 100 miles"
. format gp100m %5.2f
. correlate gp100m weight
(obs=74)
gp100m weight
gp100m 1.0000
weight 0.8544 1.0000
Domestic Foreign
8.00
Gallons per 100 miles
6.00
4.00
2.00
The user-interface model is type a little, get a little, etc., so that the user is always in control.
4 [ U ] 2 A brief description of Stata
Stata’s model for a dataset is that of a table — the rows are the observations and the columns are
the variables:
. list mpg weight gp100m in 1/10
1. 22 2,930 4.55
2. 17 3,350 5.88
3. 22 2,640 4.55
4. 20 3,250 5.00
5. 15 4,080 6.67
6. 18 3,670 5.56
7. 26 2,230 3.85
8. 20 3,280 5.00
9. 16 3,880 6.25
10. 19 3,400 5.26