Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Unable to create local macro in modified ado-file (xtreg_fe.ado)


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Unable to create local macro in modified ado-file (xtreg_fe.ado)
Date   Tue, 17 Jan 2012 09:16:00 +0000

Excellent diagnosis by Richard. The allowed length for local macro
names was originally 7 characters, but it was not an error to give
names that were longer; they just corresponded to names of macros that
could not exist and were ignored. -macval()- is not affected by
-version- control.

Modifying Stata's own files -- even when under a new name, the only
defensible way to do it -- can be tricky. StataCorp's developers feel
free to use undocumented features and to write code that is not
densely explained.

Nick

On Tue, Jan 17, 2012 at 4:39 AM, Richard Williams
<[email protected]> wrote:
> At 07:36 PM 1/16/2012, Bert Lloyd wrote:
>>
>> Hello all,
>>
>> Thank you very much for the discussion.
>>
>> Regarding Nick Cox's valuable suggested partial test (macrotest), that
>> and other similar tests work fine in ado-files that I create myself
>> from scratch, as well as others borrowed from co-workers, etc. This
>> problem has only occurred when attempting to modify Stata ado-files.
>
>
> One other tidbit: Your original code works when version is set to 7 but not
> 6. Further, this code works:
>
> version 6
> local mylocal Hello
>
> noisily di      "*****************"
> noisily di      "local my_test_local contains"
> noisily di "`mylocal'"
> noisily di      "*****************"
>
> Why? The whatsnew file for Stata 7 says "Stata now allows names to be up to
> 32 characters long.  That includes variable names, label names, macro names,
> and any other name you can think of." I don't know what the limit was in V 6
> -- 7 characters maybe? -- but my_test_local was probably too long of a name.
> Make your macro names shorter, like I did above, and I think your code will
> work.
>

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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index