Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Rodrigo Briceño <rjbriceno@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: RE: Re: proper use of if |
Date | Wed, 17 Nov 2010 08:59:04 -0600 |
thanks Nick and Cristopher. I decided to use "if e(sample)" and it worked perfectly. 2010/11/17 Nick Cox <n.j.cox@durham.ac.uk>: > I agree that -if e(sample)- is a good piece of syntax to know, but otherwise I don't see a practical difference here. > > If the observations couldn't be included, the result will be missing and the consequence is the same. > > Nick > n.j.cox@durham.ac.uk > > Christopher Baum > > A perhaps even better solution is to predict... if e(sample), as that will not only incorporate the if condition on the regression, but avoid predicting for any observations which could not be included in the estimation. > > On Nov 17, 2010, at 2:33 AM, Nick wrote: > >> If you read -help predict- you will see that it explains that -predict- also takes -if- if you wish. As you did not specify -if-, predictions were generated for the whole dataset, which people sometimes do want. So, just repeat -if isin2 == 1- on the -predict-. > > > > * > * 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/ > -- Rodrigo Briceño Economist rjbriceno@gmail.com MSN: jbric98@hotmail.com SKYPE: rbriceno1087 * * 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/