1 / 16

A Brief Introduction to Stata(2)

A Brief Introduction to Stata(2). 2.1. Listing the variables 2.2. Listing data 2.3. Summarizing data 2.4. Frequency distributions (tabulations) 2.5. Distributions of descriptive statistics (table) 2.6. Missing Values in STATA 2.7. Counting observations. 2.1. Listing the variables.

questa
Download Presentation

A Brief Introduction to Stata(2)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A Brief Introduction to Stata(2)

  2. 2.1. Listing the variables • 2.2. Listing data • 2.3. Summarizing data • 2.4. Frequency distributions (tabulations) • 2.5. Distributions of descriptive statistics (table) • 2.6. Missing Values in STATA • 2.7. Counting observations

  3. 2.1. Listing the variables • To see all variables in a dataset, type: • . use hh, clear • . describe • You could abbreviate a list of variables: • . describe hcn-fsize • . describe hcn-fsize • . des h*

  4. 2.2. Listing data • To list the data in a table, type: • . list • To lists all variables of the first three observations: • . list in 1/3 • . list fsize regn if sex==2 & age<20

  5. 2.3. Summarizing data • We can obtain basic summary statistics on data by typing: • . summarize • . summarize fsize age,detail • Household surveys generally provide weights to correct for the sampling design differences and sometimes data collection problems: • . sum fsize age [aw=rfact]

  6. . sort regn • . by regn: sum fsize age [aw=rfact] • Or • Bysort regn: sum fsize age [aw=rfact]

  7. 2.4. Frequency distributions (tabulations) • To get frequency distributions and cross tabulations: • . tab regn • . tab sex if regn==1 • To make a two-way distribution: • . tab hgc sex • To see percentages by row or columns • . tab regn sex, col row • . tab regn sex, col row chi

  8. 2.5. Distributions of descriptive statistics (table command) • show the mean of family size and age of household head by region: • . table regn, c(mean fsize mean age) • you can include at most five statistics. • Other options • Alternatively, you can use the tabstatcommand, • . tabstat fsize age, statistics (mean) by(region)

  9. a two-way table : • . table regn sex, c(mean fsize mean age)

  10. 2.6. Missing Values in STATA • In STATA, a missing value is represented by a period (.). • A missing value is considered larger than any number. The summarize command ignores the observations with missing values and the tabulate command does the same, unless forced include missing values.

  11. 2.7. Counting observations • .Count • . count if age>50

  12. Review • .describe hcn-fsize • . des h* • . list • . list in 1/3 • . list fsize regn if sex==2 & age<20 • . summarize • . summarize fsize age,detail • . sum fsize age [aw=rfact]

  13. . sort regn • . by regn: sum fsize age [aw=rfact] • .bysort regn: sum fsize age [aw=rfact] • . tab regn • . tab sex if regn==1 • . tab hgc sex • . tab regn sex, col row chi

  14. . table regn, c(mean fsize mean age) • . tabstat fsize age, statistics (mean) by(region) • . table regn sex, c(mean fsize mean age) • .Count • . count if age>50

  15. 2.Working with data file: Looking at the content

More Related