Statalist


[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 <[email protected]>
To   [email protected]
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

etc.

Kit Baum   |   Boston College Economics & DIW Berlin   |   http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
   An Introduction to Modern Econometrics Using Stata  |   http://www.stata-press.com/books/imeus.html



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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