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

From |
"William Bishop" <wbishopco@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Mon, 11 Feb 2008 15:23:46 -0800 |

I apologize for not including all the commands like the FAQ states. I am new here and will make sure to do that in the future. It turns out that I had a syntax error in my code that caused the problem (all the more reason to actually include all the commands). William On Feb 11, 2008 1:55 PM, Steven Samuels <sjhsamuels@earthlink.net> wrote: > 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/ > * * 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/

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

**Re: st: RE: predict with if and option***From:*Steven Samuels <sjhsamuels@earthlink.net>

- Prev by Date:
**Re: st: RE: working with large datasets** - Next by Date:
**Re: st: determining standard errors of fixed effect terms after xtreg** - Previous by thread:
**Re: st: RE: predict with if and option** - Next by thread:
**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 |