Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
AW: AW: st: RE: variable naming problem |

Date |
Tue, 7 Sep 2010 10:58:39 +0200 |

<> The server has increased its "appetite for the first lines" again, Thomas, so maybe you could send your message anew? HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Thomas Gesendet: Dienstag, 7. September 2010 10:44 An: statalist@hsphsun2.harvard.edu Betreff: Re: AW: st: RE: variable naming problem Thomas On 06/09/2010 16:33, Martin Weiss wrote: > <> > " To get a prediction at a specific point using -predict- I suppose I need > the if option." > > > I am not so sure: Do you want to restrict the observations for which you > -predict-, or do you want to hold variables at certain values? > > > > HTH > Martin > > -----Ursprüngliche Nachricht----- > Von: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Thomas > Gesendet: Montag, 6. September 2010 17:10 > An: statalist@hsphsun2.harvard.edu > Betreff: Re: st: RE: variable naming problem > > respect to the things over which the loop runs. > And these things are numbers. I do not see how I can name differently. > > To get a prediction at a specific point using -predict- I suppose I need > the if option. But as the model is quiet long and many variables drop > out -generate- involves less code. > > Thomas > > > On 06/09/2010 15:45, Nick Cox wrote: >> Only decimal points are problematic. Integer digits are allowed in > variable names after the first character. The remedy is to use evocative > names rather than numbers nevertheless. Only you can decide which names are > best for your purpose. >> Why aren't you using -predict-? >> >> Nick >> n.j.cox@durham.ac.uk >> >> Thomas >> >> after a regression I would like to generate predictions for different >> values of the original variables. >> >> The first loop generate various scaled mean values. >> >> The second and third loop then generate the predictions c* for the >> various scaled means. >> >> The problem is how to name c*. Now the names include numbers which Stata >> does not accept (error: invalid name). >> >> Any ideas how I can get around this? >> >> ________________ >> >> foreach var of varlist yU yD{ >> sum `var' if e(sample) >> local m`var' = `r(mean)' >> local m25`var' = 0.25*`r(mean)' >> local m50`var' = 0.5*`r(mean)' >> local m75`var' = 0.75*`r(mean)' >> local m2`var' = 2*`r(mean)' >> local m3`var' = 3*`r(mean)' >> local m4`var' = 4*`r(mean)' >> } >> >> foreach i in `myU' `m25yU' `m50yU'{ >> foreach p in `myD' `m25yD' `m50yD'{ >> gen c`i'_`p' = _b[_cons]+_b[yU]*(`i')+_b[yU2]*((`i')^2/2) > /// >> +_b[yD]*(`p')+_b[yD2]*((`p')^2/2) if e(sample) >> } >> } >> >> >> * >> * 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/ >> > * > * 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/ > > > * > * 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/ > * * 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/ * * 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/

**Follow-Ups**:**Re: AW: AW: st: RE: variable naming problem***From:*Thomas <tpt21@cam.ac.uk>

**References**:**st: variable naming problem***From:*Thomas <tpt21@cam.ac.uk>

**st: RE: variable naming problem***From:*Nick Cox <n.j.cox@durham.ac.uk>

**Re: st: RE: variable naming problem***From:*Thomas <tpt21@cam.ac.uk>

**AW: st: RE: variable naming problem***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**Re: AW: st: RE: variable naming problem***From:*Thomas <tpt21@cam.ac.uk>

- Prev by Date:
**Re: st: Multiple Imputation on Panel Data: all variables have missing data, and the panels are expanding** - Next by Date:
**Re: st: Multiple Imputation on Panel Data: all variables have missing data, and the panels are expanding** - Previous by thread:
**Re: AW: st: RE: variable naming problem** - Next by thread:
**Re: AW: AW: st: RE: variable naming problem** - Index(es):