2026 Stata Conference 1–2 October Boston, MA
Data Analysis Using Stata, Fourth Edition |
||||||||||||||||||||||||||||||||||||||
![]() Click to enlarge See the back cover |
$68.00 VitalSource eBook Add to cart$62.00 Amazon Kindle Buy from Amazon
As an Amazon Associate, StataCorp earns a small referral credit from
qualifying purchases made from affiliate links on our site.
|
|
||||||||||||||||||||||||||||||||||||
Comment from the Stata technical groupData Analysis Using Stata, Fourth Edition is a perfect resource for anyone just learning statistics and Stata, as well as for users who are switching to Stata from other packages. Kohler, Kreuter, and Haensch take a hands-on approach to teaching, first showing the reader how to use Stata's interface and syntax and then introducing aspects of social science research with examples that allow the reader to work along. Throughout the book, the authors bring concepts to life by using updated data from the German Socio-Economic Panel, a large survey of households containing demographic, income, employment, and other key information. The authors carefully introduce data management, reporting, and statistical analysis. You will learn to create tables and graphs and to fit and interpret linear and logistic regression models. The authors discuss important statistical topics such as random samples, complex survey samples, nonresponse, and causal inference. Along the way, readers will also learn about tools for automation and programming. The fourth edition of the book is updated for Stata 19 and expanded to introduce modern research techniques. The book now includes discussion of Python integration and an example demonstrating its use for web scraping. New sections introduce machine learning and discuss the differences between causal inference, parsimonious description, and prediction. The authors explore the use of large language models and provide advice on using AI to support your coding and data-processing tasks. They also introduce dynamic documents for reproducibly documenting your analysis. Data Analysis Using Stata, Fourth Edition is an excellent textbook for an introductory data analysis or statistics course. Teaching with this book is made easy—the authors include a section in the preface with advice for teaching with the text, and they offer exercises at the end of each chapter. This book is also a fantastic self-study resource for researchers in social sciences who wish to learn Stata and statistics. |
||||||||||||||||||||||||||||||||||||||
About the authorsUlrich Kohler is a professor for methods of empirical social research at the University of Potsdam. He is an organizer of the German Stata Conference. Frauke Kreuter is a professor at the Department of Statistics in the Ludwig-Maximilians-University (LMU) of Munich and director of the Social Data Science Center at the University of Maryland, College Park. Caro Haensch is a lecturer and group leader at LMU Munich and Assistant Research Professor at the University of Maryland. All authors have used Data Analysis Using Stata to teach classes and short courses on various levels, including at LMU Munich; the Universities of Potsdam, Mannheim, and Konstanz; the Free University of Berlin; the University of California, Los Angeles; and the University of Maryland. |
||||||||||||||||||||||||||||||||||||||
Table of contentsView table of contents >> List of tables
List of figures
Preface (PDF)
Acknowledgments
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-files 1.3.2 Loading data 1.3.3 Variables and observations 1.3.4 Looking at data 1.3.5 Interrupting a command and repeating a command 1.3.6 The variable list 1.3.7 The in qualifier 1.3.8 Summary statistics 1.3.9 The if qualifier 1.3.10 Defining missing values 1.3.11 The by prefix 1.3.12 Command options 1.3.13 Frequency tables 1.3.14 Graphs 1.3.15 Getting help Excursus: Large language models as programming help 1.3.16 Recoding variables 1.3.17 Variable labels and value labels 1.3.18 Linear regression 1.5 Dynamic documents 1.6 Exiting Stata 1.7 Around Stata
1.7.1 Resources and information
1.8 Exercises 1.7.2 Updating Stata 1.7.3 Additional procedures Stata Journal ado-files Statistical Software Components Archive ado-files 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-files 2.1.2 Alternative 2
2.2.1 Comments
2.3 Organizing your work 2.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 commands 3.1.2 The variable list List of variables: Required or optional Abbreviation rules Special listings 3.1.3 Options 3.1.4 The in qualifier 3.1.5 The if qualifier 3.1.6 Expressions Operators Functions 3.1.7 Lists of numbers 3.1.8 Using filenames
3.2.1 The by prefix
3.3 Weights 3.2.2 The foreach loop The types of foreach lists Several commands within a foreach loop 3.2.3 The forvalues loop
Frequency weights
3.4 Exercises Analytic weights Sampling weights 4 General comments on the statistical commands
4.1 Regular statistical commands
4.2 Estimation commands 4.3 Integration of other programming languages in Stata 4.4 Export and import from Python
4.4.1 Finding and using the right Python version
4.5 Exercises 4.4.2 Installing Python modules from within Stata 4.4.3 The Stata Python module 4.4.4 Large language models as programming assistant for Python 5 Creating and changing variables
5.1 The commands generate and replace
5.1.1 Variable names
5.2 Setting missing values 5.1.2 Some examples 5.1.3 Useful functions 5.3 Labels 5.4 Specialized recoding commands
5.4.1 The recode command
5.5 Recoding string variables 5.4.2 The egen command 5.4.3 Changing codes with by, __n, and __N 5.4.4 Subscripts 5.6 Recoding date and time
5.4.1 Dates
5.7 Storage types, or the ghost in the machine 5.4.2 Time 5.8 Exercises 6 Creating and changing graphs
6.1 A primer on graph syntax
6.2 Graph types
6.2.1 Examples
6.3 Graph elements 6.2.2 Specialized graphs
6.3.1 Appearance of data
6.4 Multiple graphs Choice of marker Marker colors Marker size Lines 6.3.2 Graph and plot regions Graph size Plot region Scaling the axes 6.3.3 Information inside the plot region Reference lines Labeling inside the plot region 6.3.4 Information outside 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 graphs 6.4.2 Option by() 6.4.3 Combining graphs 6.6 Graphs with Python (within Stata) 6.7 Large language models as programming help with graphs 6.8 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 More than one frequency table Comparing distributions Summary statistics More than one contingency table 7.2.2 Graphs Histograms Bar charts Pie charts Dot charts
7.3.1 Frequencies of grouped data
7.4 Exercises Some remarks on grouping data Special techniques for grouping data 7.3.2 Describing data using statistics Important summary statistics The summarize command The tabstat command Comparing distributions using statistics 7.3.3 Graphs Box plots Histograms Kernel density estimation Quantile plot Comparing distributions with Q–Q plots 8 Statistical inference
8.1 Random samples and sampling distributions
8.1.1 Random numbers
8.2 Descriptive inference 8.1.2 Creating fictitious datasets 8.1.3 Drawing random samples 8.1.4 The sampling distribution
8.2.1 Standard errors for simple random samples
8.3 Causal inference 8.2.2 Standard errors for complex samples Typical forms of complex samples Sampling distributions for complex samples Using Stata’s svy commands 8.2.3 Standard errors with nonresponse Unit nonresponse and poststratification weights Item nonresponse and multiple imputation 8.2.4 Uses of standard errors Confidence intervals Significance tests Two-group mean comparison test
8.3.1 Basic concepts
8.4 Predictive inference Data-generating processes Potential outcomes Controlling for observables 8.3.2 The effect of third-class tickets
8.4.1 Quantifying prediction quality
8.5 Exercises 8.4.2 Find the best split 8.4.3 The best split for all variables 8.4.4 Continue learning 8.4.5 Training and test 9 Introduction to linear regression
9.1 Simple linear regression
9.1.1 The basic principle
9.2 Multiple regression 9.1.2 Linear regression using Stata The table of coefficients The table of ANOVA results The model fit table
9.2.1 Multiple regression using Stata
9.3 Regression diagnostics 9.2.2 Derived statistics Adjusted R2 Standardized regression coefficients 9.2.3 Categorical independent variables 9.2.4 Interaction terms 9.2.5 Regression models using transformed variables 9.2.6 Why do we use multiple regression? Parsimonious description Adjustment of the substantive interpretation of regression coefficients Estimation of causal effects Prediction
9.3.1 Violation of E(εi) = 0
9.4 Reporting regression results Linearity Influential data points Omitted variables 9.3.2 Violation of Var(εi) = σ2 9.3.3 Violation of Cov(εi, εj) = 0, i ≠ j
9.4.1 Tables of similar regression models
9.5 Advanced models for causal inference 9.4.2 Plots of coefficients 9.4.3 Profile plots
9.5.1 Causal-effect estimation from observational data
9.6 Exercises 9.5.2 Controlling for unobserved confounders using panel data Between, within, and difference in differences From wide to long format Within and DID using first principles First-difference model Two-way fixed-effects models 9.5.3 Instrumental-variable regression 10 Regression models for categorical dependent variables
10.1 The linear probability model
10.2 Basic concepts
10.2.1 Odds, log odds, and odds ratios
10.3 Logistic regression with Stata 10.2.2 Excursion: The maximum likelihood principle
10.3.1 The coefficient table
10.4 Logistic regression diagnostics Sign interpretation Interpretation with odds ratios Probability interpretation Average marginal effects 10.3.2 The iteration block 10.3.3 The model fit block Classification tables Pearson chi-squared
10.4.1 Linearity
10.5 Likelihood-ratio test 10.4.2 Influential cases 10.6 Refined models
10.6.1 Nonlinear relationships
10.7 Related models 10.6.2 Interaction effects
10.7.1 Probit models
10.8 Exercises 10.7.2 Multinomial logistic regression 10.7.3 Models for ordinal data 11 Reading and writing data
11.1 The goal: The data matrix
11.2 Importing machine-readable data
11.2.1 Reading system files from other packages
11.3 Inputting data Reading Excel files Reading SPSS files Reading SAS files Reading other system files 11.2.2 Reading text files Reading data in spreadsheet format Reading data in free format Reading data in fixed format
11.3.1 Input data using the Data Editor
11.4 Web scraping 11.3.2 The input command 11.5 Combining data
11.5.1 The GSOEP database
11.6 Saving and exporting data 11.5.2 The merge command Merge 1:1 matches with rectangular data Merge 1:1 matches with nonrectangular data Merging more than two files Merging m:1 and 1:m matches 11.5.3 The append command 11.5.4 Combining data with frames Frames as alternative to merge and append Frames to collect results 11.7 Unicode
11.7.1 Code tables
11.8 Exercises 11.7.2 Compatibility issues 11.7.3 Babel 12 Do-files for advanced users and user-written programs
12.1 Two examples of usage
12.2 Four programming tools
12.2.1 Local macros
12.3 User-written Stata commands Calculating with local macros Combining local macros Changing local macros 12.2.2 Do-files 12.2.3 Programs The problem of redefinition The problem of naming The problem of error checking 12.2.4 Programs in do-files and ado-files
12.3.1 Sketch of the syntax
12.4 Exercises 12.3.2 Create a first ado-file 12.3.3 Parsing variable lists 12.3.4 Parsing options 12.3.5 Parsing if and in qualifiers 12.3.6 Generating an unknown number of variables 12.3.7 Default values 12.3.8 Extended macro functions 12.3.9 Avoiding changes in the dataset 12.3.10 Help files References
Author index (PDF)
Subject index (PDF)
|
||||||||||||||||||||||||||||||||||||||
Learn
Free webinars
NetCourses
Web training
Organizational training
Video tutorials
Third-party courses
Web resources
Teaching with Stata
© Copyright 1996–2026 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.

