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

st: RE: Re: Invalid syntax in -xtdes- command


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: Invalid syntax in -xtdes- command
Date   Mon, 13 Oct 2003 14:23:32 +0100

wastata
> 
> --- In [email protected], "Scott Merryman" <smerryman@k...>
> wrote:
> > ----- Original Message -----
> > From: "West Addison" <wastata@y...>
> > To: <statalist@h...>
> > Sent: Friday, October 10, 2003 6:31 PM
> > Subject: st: Invalid syntax in -xtdes- command
> >
> >
> > > I have a panel data set and attempted to run the xtdes
> > > command on it in Stata version 7 for Windows.  The
> > > command started to run okay and produced the first few
> > > lines of output but then failed with the error message
> > > "invalid syntax r(198);".  My syntax looks fine as far
> > > as I can tell from the manual--I am just typing
> > > "xtdes" with no options--by I am new to this command
> > > and may be missing something.  Is there a bug in
> > > xtdes?  Here is what my log looks like:
> > >
> > > . use E:\Projects\HAP\DataSets\analysis.dta
> > >
> > > . tsset id_number time_from_intake
> > >        panel variable:  id_number, 394 to 1412
> > >         time variable:  time_from_intake, -24 to 12,
> > > but with gaps
> > >
> > > . xtdes
> > >
> > > id_number:  394, 399, ..., 1412
> > >       n =        288
> > > time_from_intake:  -24, -23, ..., 12
> > >       T =         37
> > >            Delta(time_from_intake) = 1; (12--24)+1 =
> > > 37
> > >            (id_number*time_from_intake uniquely
> > > identifies each observation)
> > >
> > > Distribution of T_i:   min      5%     25%       50%
> > >     75%     95%     max
> > >                          1       1       1         3
> > >       5      14      29
> > > invalid syntax
> > > r(198);
> > >
> > > .
> >
> > The problem is that you have negative time values.  If you -set
> trace on- and
> > then run -xtdes- you will see that it chokes when tries 
> to create a
> new variable
> > named _T`time value', but _T-24 is not a valid name.
> >
> > From the trace:
> >
> > - gen int _T`i' = 1 if `tvar'==`i'
> > = gen int _T-24 = 1 if t==-24
> > invalid syntax
> >
> > If you create a new time variable, such as
> >
> > gen time2 = time_ + 24
> >
> > xtdes should work fine.
> 
> Thanks, Scott.  You seem to a have pinpointed the problem with
> xtdes.  I would say this is a bug, because the manual, in the entry
> for xt, states that negative values of the time variable 
> are allowed:
> "[The time variable] must be a single, numeric variable, although
> whether it takes on the values 1, 2, 3 or 1, 7, 9, or even -2, sqrt
> (2), pi is irrelevant."
> 
> Thanks again for your help.
> 
> West
> 
> *
> *   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/

Good point. However, my perspective from 
a distance is this: 

1. I read this as mostly a documentation 
bug. You can't get far with declaring as a time 
variable anything with non-integer values. 

2. It would seem in addition that there is a 
specific and implicit assumption in -xtdes- 
which may well be easily fixable. For example, there is no 
obvious reason why variables created on 
the fly should not have names such as _Tm24, 
etc., for this situation. 

Nick 
[email protected] 
*
*   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