[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Steven Samuels <sjhsamuels@earthlink.net> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: predict with if and option |

Date |
Mon, 11 Feb 2008 16:55:40 -0500 |

It looks like you are trying to run the -predict- statement inside some kind of double loop. I don't know the innards of -predict-, but I'd guess it is trying to create the same variable for every value of the loop arguments. If you had done "generate temp =foobar" inside a loop, this would generate an error that the 'variable already exists'; perhaps your error is the same. If the loop did the prediction for the first time through on both arguments, that's the problem. There are many possible solutions, including naming the new variable by appending "i" and "t".

Maybe: "predict temp`i'`t' if ..."

Statalist FAQ state that you should show all the commands and all the output that Stata generated. As Nick states, you haven't listed enough for us to really know what went wrong.

-Steven

samplerx@earthlink.net

On Feb 11, 2008, at 4:35 PM, Nick Cox wrote:

This worked for me. sysuse auto regress mpg weight predict foobar if rep78 < 3, stdp I guess that you are doing something different that you are not telling us, e.g. using a command other than -regress-. Nick n.j.cox@durham.ac.uk William Bishop I would like to run predict with the IF condition after a regression, using the stdp option at the same time but am getting the error "option stdp not allowed" predict temp if id=="`i'"&n==`t', stdp seems pretty basic. what am I missing? maybe I misunderstood the documentation on predict, but I thought this was doable. *

* * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: RE: predict with if and option***From:*"William Bishop" <wbishopco@gmail.com>

**References**:**st: predict with if and option***From:*"William Bishop" <wbishopco@gmail.com>

**st: RE: predict with if and option***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

- Prev by Date:
**st: RE: working with large datasets** - Next by Date:
**Re: st: RE: working with large datasets** - Previous by thread:
**st: RE: predict with if and option** - Next by thread:
**Re: st: RE: predict with if and option** - Index(es):

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