Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: help! Strange error in Stata


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: help! Strange error in Stata
Date   Wed, 2 Jul 2008 18:04:49 +0100

My guess too is that the right quote is the problem. As I type right
quote basic ' it is a quite different character from what you have. 

If you download the invaluable -asciiplot- from SSC 
you can get a display of characters for your machine. 

I think you are getting char(146) when you want char(39), except that
146 may take a different value on your machine. 

Nick 
[email protected] 

Kyle K. Hood

This code (within a do-file)

. sum year
. local minyear = r(min)
. local maxyear = r(max)
. local yrdiff = `maxyear' - `minyear' // T-1

Generates the following result (and error):

Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
year | 2244 1979.5 12.70126 1958 2001
`maxyear' invalid name
r(198);

When I type the same code on the command line, I don't get the error -- 
however, when I erase and retype the code within the do-file, I get the 
same error. I am running Stata/SE 9. I really have no idea what is going

on. I have scrutinized for spelling, etc. The code that I sent was 
copied out of the do-file directly. I do wonder about the right single 
quote (it looks funny), but I am using Stata's do-file editor, and am 
using the single-quote-key directly to the left of the "enter" key. Can 
anyone help?

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