Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: RE: obvious error?


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: obvious error?
Date   Tue, 18 Oct 2005 18:54:11 +0100

Another point is that your local macros
must be in the same space as that in which your 
-xi: xtreg- command is issued. One of the earliest
lessons in Stata programming is that -local- macros
are precisely named. But I've occasionally 
been bitten by this in the following form: 

I'm defining local macros in code 
in the do-file editor and doing something
else in the Command window. 

Then I forget momentarily that the local macros are 
invisible to the main session. 

The following experiment makes the point. 

Type

local foo "foo" 

in the Do-file editor and then run the code. 
This command will be echoed to the Results 
window but 

. di "`foo'" 

will just show an empty string [a new line, 
strictly] while 

. mac li 

will show no -foo-. That is because the code
in the do-file editor counts as a separate 
program and what you just defined exists 
only in its own space. 

This isn't a major problem, but it's a small
test of understanding. 

P.S. for those who know it, -c_local- is 
a work-around. If you don't know it, you 
shouldn't want to ask. 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Nick Cox
> Sent: 18 October 2005 18:39
> To: [email protected]
> Subject: st: RE: obvious error?
> 
> 
> The best test here that you and Stata 
> are speaking the same language is to 
> 
> . mac li 
> 
> to see what Stata is holding in local 
> macros. If you typed, as stated here, 
> 
> . local x1lsr age age2 hgc
> 
> then the local macro -x1lsr- will
> hold "age age2 hgc" and it is entirely 
> possible that the local macro -x1- 
> is not defined. 
> 
> But I can't see what is wrong with 
> your other example. 
> 
> Stata is not _asking_ for last estimates. 
> It can't see any variable names, so is 
> presuming that you are asking for a replay; 
> but it can't oblige, as it cannot find 
> the last estimates from that command. 
> 
> Nick 
> [email protected] 
> 
> Scott Cunningham
>  
> > This is stumping me.  Here's a sample of my code and the error I'm  
> > getting.  I know I'm doing some obviously wrong, but it's 
> so obvious  
> > that I can't see it.
> > 
> > . local y rp
> > . local x1lsr age age2 hgc
> > . local x3 lsr age age2 hgc i.year state*
> > 
> > . xi: xtreg `y' `x1', fe i(id) robust
> > last test not found
> > r(302);
> > 
> > I get the same error even when I run the following regression:
> > 
> > . xi: xtreg `y' `x3', fe i(id) robust
> > last estimates not found
> > r(301);
> > 
> > So I know it's not just the fact that I'm using the -xi- operator  
> > without including the year dummies for the first FE 
> regression.  Why  
> > is it asking me for "last estimates"?
> > 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index