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

st: RE: RE: Re: RE: may not use time-series operators on string variables


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Re: RE: may not use time-series operators on string variables
Date   Wed, 3 Jul 2002 19:34:51 +0100

> I wrote in response to  Lee Chuntao
>
> > > >    In my dataset there is a variable v1, which is a string
> > > > variable. I try to use l.v1, after i set the time variable (eg,
> > > > tsset time). I don't know why stata do not permit timeseries
> > > > operators on string variables, it seems not reasonable for the
> > > > lag or lead operators, beyond the difference operators
> > > >
> > > > i wonder if there is some sort way so that i can use the laged
> > > > string variable?
> > >
> > > Yes. -destring- your string variable first. Stata quite reasonably
> > > wants you to have your variables with numeric meaning held as numeric.
> > >
>
> to which he replied
>
> > But Why shoud my variable be numeric, that is not reasonable. In
> > fact, my variable is industry code, never ever be numeric.
> >
> > I do not think Nick's answer helpful
> >
> > In this aspect, i think stata should admit its shortcomings and
> > fix the problem asap

To add a few thoughts to my previous reply:

1. if a string variable for industry code is a covariate, then could it be
used in any time series
model as a covariate anyway?

2. for descriptive purposes, previous industry code is, once data have
been -tsset-,

indcode[_n-1]

or if there are gaps to worry about

indcode[_n-1] if year == year[_n-1] + 1

or whatever it is.

Nick
n.j.cox@durham.ac.uk

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index