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]'" <[email protected]>
Subject   RE: st: Unable to create local macro in modified ado-file (xtreg_fe.ado)
Date   Mon, 16 Jan 2012 16:59:36 +0000

First, it is not surprising that 

est hidden scalar ui = sqrt(r(Var))

does not work. It is illegal: what is that "hidden" doing there?  

That said, there is something bizarre going on here. 

Forgetting for a moment -xtreg- details, the main point is that what Bert is trying to do with a local macro is utterly standard. Also, there should in this case be absolutely no difference between the results of copying a macro and evaluating a macro. 

On my set-up, in Stata 12 running -macrotest- as below 

program macrotest
        
        local my_test_local Hello
        di "`my_test_local'" 
        local my_test_local = "Hello"
        di "`my_test_local'" 
        
end   

displays, as expected "Hello", twice. That is a partial test for Bert. 

I don't have an explanation for why Bert can't reproduce similar behaviour, but I have various comments: 

1. This problem absolutely should not need a work-around. Something is wrong and needs to be found and fixed. 

2. Bert may have multiple versions of his program in different files in different places. He may think he is running one when he is running another. 

3. In at least some cases there may be a bizarre typo in one of his files e.g. a non-standard space or the character "1" (one) where "l" (l.c. l) should be. I have not found any problems in the file he posted on dropbox.

Nick 
[email protected] 

Bert Lloyd

The second of your methods (n di "`macval(my_test_local)'") works for
me but not the first (loc my_test_local = "Hello").

Thanks very much for coming up with a workable solution.

And, I should have mentioned that this problem occured using Stata
12.0 for Windows 64 Bit on a Windows 7 machine.

This may be tangential but: I tried testing your solution in Stata
11.2, and the macro fix worked fine, but the program crashed on the
"est hidden scalar ui = sqrt(r(Var))" line in xtreg_fe_modified.ado,
with error r(198) "Invalid syntax."

This is a bit strange since the call to xtreg_fe.ado performs fine in
11.2. I don't understand why xtreg_fe_modified would crash, since the
two are identical except for the lines included above -- which ought
not to have any functional relevance.


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