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]

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


From   Bert Lloyd <[email protected]>
To   [email protected]
Subject   st: Unable to create local macro in modified ado-file (xtreg_fe.ado)
Date   Sun, 15 Jan 2012 15:02:02 -0500

Dear Statalist,

I am trying to make some slight modifications to xtreg_fe.ado and am
having problems creating local macros inside the ado-file.

When I try to create a local macro, it does not seem to be recognized
within the ado-file.

As an example, if I insert the following lines at an arbitrary location

local my_test_local Hello
noisily di 	"*****************"
noisily di 	"local my_test_local contains"
noisily di "`my_test_local'"
noisily di 	"*****************"

I get the following output:

*****************
local my_test_local contains

*****************

I have experimented with enclosing Hello in double-quotes, evaluating
with the = operator, etc., none of which seems to make a difference.

Interestingly, the same problem does not occur when creating scalars:

scalar my_test_scalar = 1234
noisily di 	"*****************"
noisily di 	"scalar my_test_scalar contains"
noisily di 	my_test_scalar
noisily di 	"*****************"

produces

*****************
scalar my_test_scalar contains
1234
*****************

Also, there seems to be no problem accessing local macros that have
already been defined in the original xtreg_fe.ado. For example, line
178 of the original ado-file creates the local macro nobs:

local nobs = e(N)

If I then add
noisily di 	"*****************"
noisily di 	"local nobs contains"
noisily di 	"`nobs'"
noisily di 	"*****************"

I get the following

*****************
local nobs contains
1000
*****************

(1000 is the right number in my little simulation).

I have uploaded xtreg_fe_modified.ado, which is identical to
xtreg_fe.ado except for the modifications discussed above, here:

http://dl.dropbox.com/u/57392331/xtreg_fe_modified.ado

Note that the modifications begin at line 180 and end at line 195.

A simple do-file that creates simulated data and calls
xtreg_fe_modified.ado, is uploaded here:

http://dl.dropbox.com/u/57392331/test_xtreg_fe_modified.do

Any advice appreciated and many thanks in advance.

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