[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: How do I keep the same sample size without deleting cases?

From   Kit Baum <>
Subject   st: How do I keep the same sample size without deleting cases?
Date   Sat, 20 Jun 2009 06:47:34 -0400

Dimitris said

I am a new stata user, so excuse me for my ignorance...I am using panel data and I want to do my descriptive analysis and my exploratory analysis having (of course) the same number of observations. I first rum my prbot model and then I make tables with means using e(sample in my "if" statement and everything goes well. However when I do crostabs (using ta or table) the number of observations is different (higher to be exact). I have observed, while making the means tables, that when I dont include in my descriptives all the variables used in the probit model then the sample size changes. How can I keep the sample size the same without deleting the missings?

sysuse auto
probit foreign rep78 price mpg weight // drops 5 obs due to missings on rep78
g byte want = e(sample)
tab mpg foreign if want
su displacement turn if want


Kit Baum   |   Boston College Economics & DIW Berlin   |
An Introduction to Stata Programming |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index