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

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

From |
Nick Cox <n.j.cox@durham.ac.uk> |

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

Subject |
RE: st: RE: new explanatory variable in a loop |

Date |
Tue, 7 Dec 2010 19:35:28 +0000 |

For version 9 the equivalent (and terser) manual reference is [U] 18.3.4. Nick n.j.cox@durham.ac.uk Rodrigo Briceño Thanks again. I need to wait to read your article since I have to pay to read it. 2010/12/7 Nick Cox <n.j.cox@durham.ac.uk>: > Clearly, that wasn't explicit. > > By the way, the habit of including equals signs when not needed as in > > loc X = "sap liqmk m2-m12 mes pprom" > > will bite you sooner or later. See > > SJ-8-4 pr0045 . . . . . . . . Stata tip 70: Beware the evaluating equal sign > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox > Q4/08 SJ 8(4):586--587 (no commands) > tip explaining the pitfall of losing content in a macro > because of limits on the length of string expressions > > or its references. > > Nick > n.j.cox@durham.ac.uk > > Rodrigo Briceño > > thanks Nick. No, my dummy has 1s and 0s, based on some previous > analysis of residuals. > > 2010/12/7 Nick Cox <n.j.cox@durham.ac.uk>: > >> Yes, you _can_ do that. The central line would become >> >> quietly regress liq `X' d`i' if isin2==`i' >> >> However, if each dummy is 1 if and only if the identifier is that named, then the dummy is identically 1 and no purpose is served thereby. Thus if -d3- is 1 if and only if -isin2- is 3, then your variable is just a constant. >> >> Nick >> n.j.cox@durham.ac.uk >> >> Rodrigo Briceño >> >> Hello again Stata listers. I am running several regressions (stata >> 9.2, windows XP) that contains a set of dummies (each dummy is defined >> as a "d" plus the identification number of the bond considered. So for >> id3, the dummy is d3, and so on. I made the following loop (this is a >> shortened version; the original include tests and exporting >> coefficients using estimates store and estout): >> >> loc X = "sap liqmk m2-m12 mes pprom" >> local isin "3 4 247 1 5 6" >> foreach i of local isin { >> quietly regress liq `X' if isin2==`i' >> } >> >> My question to the list is: can I include something like d`i' as a >> new explanatory variable? What I need is that each regression include >> its corresponding dummy, so I can do the process automatically instead >> of typing individual commands: >> >> regress liq sap liqmk m2-m12 mes pprom d3 if isin2==3 >> regress liq sap liqmk m2-m12 mes pprom d4 if isin2==4 > * * 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/

**References**:**st: new explanatory variable in a loop***From:*Rodrigo Briceño <rjbriceno@gmail.com>

**st: RE: new explanatory variable in a loop***From:*Nick Cox <n.j.cox@durham.ac.uk>

**Re: st: RE: new explanatory variable in a loop***From:*Rodrigo Briceño <rjbriceno@gmail.com>

**RE: st: RE: new explanatory variable in a loop***From:*Nick Cox <n.j.cox@durham.ac.uk>

**Re: st: RE: new explanatory variable in a loop***From:*Rodrigo Briceño <rjbriceno@gmail.com>

- Prev by Date:
**Re: st: RE: new explanatory variable in a loop** - Next by Date:
**st: RE: Seeking info on CEM cutpoints algorithms - e.g., scott, ff, fd etc.** - Previous by thread:
**Re: st: RE: new explanatory variable in a loop** - Next by thread:
**[no subject]** - Index(es):