The key point is the -local- character
of local macros, as explained in an
earlier posting. Now some dangerous
advice has been given and taken.
NEVER put a varlist into a local macro
using assignment IF you are just copying it
as a string.
This is a much rehearsed piece of advice
on this list.
Once more:
local name = "<varlist>"
will get truncated after some limit on
the number of characters in a string
expression. Outside Stata/SE, this
could be as low as 80. For those
whose models have the order of 42 predictors,
this will mess up your results and/or
cause some possibly puzzling error messages.
The = sign is not cosmetic. It flags
to Stata that an expression is coming up
which must be evaluated.
But if you just a plain varlist to copy,
there is nothing to evaluate. Just go
local name "<varlist>"
_even_ when you know that the <varlist>
is very short. That way, you get into
a good habit.
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Andrea
> Molinari
> Sent: 22 July 2004 18:50
> To: [email protected]
> Subject: st: Re: RE: macro problem
>
>
> Thanks very much for the suggestions.
> Either
> local name="varlist"
> regress depvar `name'
> Or including the local into another program did the trick!
> Andrea
>
> ----- Original Message -----
> From: "Raymundo Perez Rico" <[email protected]>
> To: <[email protected]>
> Sent: Thursday, July 22, 2004 6:45 PM
> Subject: st: RE: macro problem
>
>
> > *This message was transferred with a trial version of
> CommuniGate(tm) Pro*
> >
> > Try :
> >
> > local grav="lrgdp95m lrgdp95x lrgdp95pcm lrgdp95pcx adj
> lingtie ldist
> eumxc"
> > regress lrebilm `grav'
> >
> > I hope this helps.
> >
> > Raymundo
> >
> >
> >
> > -----Mensaje original-----
> > De: [email protected]
> > [mailto:[email protected]]En nombre de Andrea
> > Molinari
> > Enviado el: Jueves, 22 de Julio de 2004 12:33 p.m.
> > Para: [email protected]
> > Asunto: st: macro problem
> >
> >
> > *This message was transferred with a trial version of
> CommuniGate(tm) Pro*
> > Dear all,
> >
> > I'm (also!) trying to run a very very simple macro to save
> me writing lots
> > of regressors every time I change the specification, but it
> does not seem
> to
> > be working when I run it on my do-file. Ideally, I'd want
> to define a
> local
> > for each specification, but for now I need to have a core
> model and then
> add
> > more variables.
> >
> > I'm writing:
> > local grav lrgdp95m lrgdp95x lrgdp95pcm lrgdp95pcx adj
> lingtie ldist eumxc
> >
> > regress lrebilm `grav'
> >
> > (and also tried local grav "lrgdp95m lrgdp95x lrgdp95pcm
> lrgdp95pcx adj
> > lingtie ldist eumxc")
> >
> > But the macro is not interpreted when I'm running it from
> the do file (it
> > does work either way when I type it on the Stata Command window).
> >
> > I guess I should be missing something in my do file, but
> can't figure out
> > what it may be. Any suggestions are more than welcomed!
> >
> > Thanks,
> > Andrea
> >
> >
> > *
> > * 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/
> >
>
>
> *
> * 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/