
Stata 19 is here—explore all the features.
Data Analysis Using Stata, Second Edition |
||||||||||||||||||||||||||||||||||
![]() Click to enlarge See the back cover |
eBook not available for this title
eBook not available for this title --> |
Preface to the Second Edition
Preface to the First Edition Author index Subject index Download the datasets used in this book (from stata-press.com) Review of the first edition from the Stata Journal |
||||||||||||||||||||||||||||||||
Comment from the Stata technical groupUpdated to include changes to Stata over the past several years, Data Analysis Using Stata, Second Edition comprehensively introduces Stata and will be useful to those who are just learning statistics and Stata, as well as to users who are switching to Stata from other packages. Throughout the book, Kohler and Kreuter show examples using data from the German Socioeconomic Panel, a large survey of households containing demographic, income, employment, and other key information. In this new edition, the authors describe the Graph Editor and time-of-day variables, two features added in Stata 10. Kohler and Kreuter’s book is a valuable introduction to Stata. The authors take a hands-on approach, leading you step by step through actual Stata sessions to answer practical questions commonly asked by social scientists. They begin with an introduction to the Stata interface and then proceed with a description of Stata syntax and simple programming tools like foreach loops. The core of the book includes chapters on producing tables and graphs, performing linear regression, and using logistic regression. Kohler and Kreuter use multiple examples to illustrate all key concepts. The rest of the book includes chapters on reading text files, writing programs and ado-files, and using Internet resources, such as the search command and the SSC archive. |
||||||||||||||||||||||||||||||||||
Table of contentsView table of contents >> List of Tables
List of Figures
Preface (pdf)
1 “The first time”
1.1 Starting Stata
1.2 Setting up your screen 1.3 Your first analysis
1.3.1 Inputting commands
1.4 Do-files1.3.2 Files and the working memory 1.3.3 Loading data 1.3.4 Variables and observations 1.3.5 Looking at data 1.3.6 Interrupting a command and repeating a command 1.3.7 The variable list 1.3.8 The in qualifier 1.3.9 Summary statistics 1.3.10 The if qualifier 1.3.11 Define missing values 1.3.12 The by prefix 1.3.13 Command options 1.3.14 Frequency tables 1.3.15 Variable labels and value labels 1.3.16 Graphs 1.3.17 Getting help 1.3.18 Recoding of variables 1.3.19 Linear regression 1.5 Exiting Stata 1.6 Exercises 2 Working with do-files
2.1 From interactive work to working with a do-file
2.1.1 Alternative 1
2.2 Designing do-files2.1.2 Alternative 2
2.2.1 Comments
2.3 Organizing your work2.2.2 Line breaks 2.2.3 Some crucial commands 2.4 Exercises 3 The grammar of Stata
3.1 The elements of Stata commands
3.1.1 Stata commands
3.2 Repeating similar commands3.1.2 The variable list
List of variables: Required or optional
3.1.3 OptionsAbbreviation rules Special listings 3.1.4 The in qualifier 3.1.5 The if qualifier 3.1.6 Expressions
Operators
3.1.7 Lists of numbersFunctions 3.1.8 Using filenames
3.2.1 The by prefix
3.3 Weights3.2.2 The foreach loop
The types of foreach lists
3.2.3 The forvalues loopSeveral commands within a foreach loop
Frequency weights
3.4 Exercises Analytic weights Probability weights 4 General comments on the statistical commands
4.1 Exercises
5 Creating and changing variables
5.1 The commands generate and replace
5.1.1 Variable names
5.2 Specialized recoding commands5.1.2 Some examples 5.1.3 Changing codes with by, _n, and _N 5.1.4 Subscripts
5.2.1 The recode command
5.3 More tools for recording data5.2.2 The egen command
5.3.1 String functions
5.4 Commands for dealing with missing values5.3.2 Date and time functions
Dates
Time 5.5 Labels 5.6 Storage types, or the ghost in the machine 5.7 Exercises 6 Creating and changing graphs
6.1 A primer on graph syntax
6.2 Graph types
6.2.1 Examples
6.3 Graph elements6.2.2 Specialized graphs
6.3.1 Appearance of data
6.4 Multiple graphs
Choice of marker
6.3.2 Graph and plot regionsMarker colors Marker size Lines
Graph size
6.3.3 Information inside the plot regionPlot region Scaling the axes
Reference lines
6.3.4 Information outside the plot regionLabeling inside the plot region
Labeling the axes
Tick lines Axis titles The legend Graph titles
6.4.1 Overlaying many twoway graphs
6.5 Saving and printing graphs6.4.2 Option by() 6.4.3 Combining graphs 6.6 Exercises 7 Describing and comparing distributions
7.1 Categories: Few or many?
7.2 Variables with few categories
7.2.1 Tables
7.3 Variables with many categories
Frequency tables
7.2.2 GraphsMore than one frequency table Comparing distributions Summary statistics More than one contingency table
Histograms
Bar charts Pie charts Dot charts
7.3.1 Frequencies of grouped data
7.4 Exercises
Some remarks on grouping data
7.3.2 Describing data using statisticsSpecial techniques for grouping data
Important summary statistics
7.3.3 GraphsThe summarize command The tabstat command Comparing distributions using statistics
Box plots
Histograms Kernel density estimation Quantile plot Comparing distributions with Q–Q plots 8 Introduction to linear regression
8.1 Simple linear regression
8.1.1 The basic principle
8.2 Multiple regression8.1.2 Linear regression using Stata
The table of coefficients
Standard errors The table of ANOVA results The model fit table
8.2.1 Multiple regression using Stata
8.3 Regression diagnostics8.2.2 More computations
Adjusted R2
8.2.3 What does "under control" mean?Standardized regression coefficients
8.3.1 Violation of E(εi) = 0
8.4 Model extensions
Linearity
8.3.2 Violation of Var(εi) = σ2Influential cases Omitted variables Multicollinearity 8.3.3 Violation of Cov(εi, εj) = 0, i ≠ j
8.4.1 Categorical independent variables
8.5 More on standard errors8.4.2 Interaction terms 8.4.3 Regression models using transformed variables
Nonlinear relations
Eliminating heteroskedasticity
8.5.1 Bootstrap techniques
8.6 Advanced techniques8.5.2 Confidence intervals in cluster samples
8.6.1 Median regression
8.7 Exercises8.6.2 Regression models for panel data
From wide to long format
8.6.3 Error-components modelsFixed-effects models 9 Regression models for categorical dependent variables
9.1 The linear probability model
9.2 Basic concepts
9.2.1 Odds, log odds, and odds ratios
9.3 Logistic regression with Stata9.2.2 Excursion: The maximum likelihood principle
9.3.1 The coefficient table
9.4 Logistic regression diagnostics
Sign interpretation
9.3.2 The iteration blockInterpretation with odds ratios Probability interpretation 9.3.3 The model fit block
Classification tables
Pearson chi-squared
9.4.1 Linearity
9.5 Likelihood-ratio test9.4.2 Influential cases 9.6 Refined models
9.6.1 Nonlinear relationships
9.7 Advanced techniques9.6.2 Categorical independent variables 9.6.3 Interaction effects
9.7.1 Probit models
9.8 Exercises9.7.2 Multinomial logistic regression 9.7.3 Models for ordinal data 10 Reading and writing data
10.1 The goal: The data matrix
10.2 Importing machine-readable data
10.2.1 Reading system files from other packages
10.3 Inputting data10.2.2 Reading ASCII text files
Reading data in spreadsheet format
Reading data in free format Reading data in fixed format
10.3.1 Input data using the Data Editor
10.4 Combining data10.3.2 The input command
10.4.1 The GSOEP database
10.5 Saving and exporting data10.4.2 The merge command
The merge procedure
10.4.3 The append commandKeeping track of observations Merging more than two files Merging data on different levels 10.6 Handling large datasets
10.6.1 Rules for handling the working memory
10.7 Exercises 10.6.2 Using oversized datasets 11 Do-files for advanced users and user-written programs
11.1 Two examples of usage
11.2 Four programming tools
11.2.1 Local macros
11.3 User-written Stata commands
Calculating with local macros
11.2.2 Do-filesCombining local macros Changing local macros 11.2.3 Programs
The problem of redefinition
11.2.4 Programs in do-files and ado-filesThe problem of naming The problem of error checking
11.3.1 Parsing variable lists
11.4 Exercises
11.3.2 Parsing options 11.3.3 Parsing if and in qualifiers 11.3.4 Generating an unknown number of variables 11.3.5 Default values 11.3.6 Extended macro functions 11.3.7 Avoiding changes in the dataset 11.3.8 Help files 12 Around Stata
12.1 Resources and information
12.2 Taking care of Stata 12.3 Additional procedures
12.3.1 SJ and STB ado-files
12.4 Exercises
12.3.2 SSC ado-files 12.3.3 Other ado-files References
Author index (pdf)
Subject index (pdf)
|
Learn
Free webinars
NetCourses
Classroom and web training
Organizational training
Video tutorials
Third-party courses
Web resources
Teaching with Stata
© Copyright 1996–2025 StataCorp LLC. All rights reserved.
×
We use cookies to ensure that we give you the best experience on our website—to enhance site navigation, to analyze usage, and to assist in our marketing efforts. By continuing to use our site, you consent to the storing of cookies on your device and agree to delivery of content, including web fonts and JavaScript, from third party web services.
Cookie Settings
Last updated: 16 November 2022
StataCorp LLC (StataCorp) strives to provide our users with exceptional products and services. To do so, we must collect personal information from you. This information is necessary to conduct business with our existing and potential customers. We collect and use this information only where we may legally do so. This policy explains what personal information we collect, how we use it, and what rights you have to that information.
These cookies are essential for our website to function and do not store any personally identifiable information. These cookies cannot be disabled.
This website uses cookies to provide you with a better user experience. A cookie is a small piece of data our website stores on a site visitor's hard drive and accesses each time you visit so we can improve your access to our site, better understand how you use our site, and serve you content that may be of interest to you. For instance, we store a cookie when you log in to our shopping cart so that we can maintain your shopping cart should you not complete checkout. These cookies do not directly store your personal information, but they do support the ability to uniquely identify your internet browser and device.
Please note: Clearing your browser cookies at any time will undo preferences saved here. The option selected here will apply only to the device you are currently using.