Bookmark and Share

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

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


scalar my_test_scalar contains

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

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:

Any advice appreciated and many thanks in advance.

 - BL
*   For searches and help try:

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