[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: st: a question about loop and local marco name
The distinction is between assignment and evaluation. If all you want to
do is assign something to a macro, you do not need the = sign and are
often better off without it. The = sign forces Stata to evaluate what it
is given before assigning it to the macro. The most simple example is as
. local a 2+2
. local b = 2+2
. di "`a'"
. di "`b'"
The first line assigned 2+2 to the local macro a - hereafter it contains
the string "2+2". The second line evaluated 2+2 and assigned the result
to macro b.
The reason why one of your examples worked the same both with and
without the = is that there was nothing to evaluate, so evaluating the
expression did not change the result.
With strings, Stata can assign a long string to a macro, but cannot
evaluate a long string - hence the problems you encountered.
Hope this helps
[mailto:firstname.lastname@example.org] On Behalf Of Jian Zhang
Sent: 26 January 2006 21:29
To: Richard Williams; email@example.com;
Subject: Re: st: a question about loop and local marco name
Thanks, Richard! Your explanation is really helpful! also, your guess is
right that I am using Intercooled and Small Stata, which explains why
the local marco command with equal sign does not work since my list has
than 80 characters.
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
* For searches and help try: