[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: Re: RE: may not use time-series operators on string variables
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
Sorry to seem unhelpful, but in my judgement there is no problem to be
except possibly some misunderstanding.
Time series operators apply to variables which change over time.
I can imagine problems in which it is reasonable to imagine that
industry code is a variable which changes over time. For
example, a person might change their employment and
so their associated industry code changes. The associated
model might be a Markov chain or something of the sort,
but this kind of model does not feature strongly in Stata's
time series commands.
It seems much likely that industry code is a covariate in
some model of Lee's, and not a response or dependent
We can only make progress by learning what Lee
wants to do, precisely, i.e. what Stata commands
he wants to apply to what response variable, what time
variable, what covariates.
* For searches and help try: