Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Re: proper use of if

From   Christopher Baum <>
To   "" <>
Subject   st: Re: proper use of if
Date   Wed, 17 Nov 2010 09:30:24 -0500

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-.

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.


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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index