[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: RE: RE: Fixed value - time series
> x is a categorical variable and can take the values 1,2,3,4.
> x is taken at periods 0(baseline),1 ,2 ,3,.. and varies over time.
> Values of x at these periods is x0, x1, x2, x3,....
> I want to generate a newvar y = x0, value at baseline, such that
> If I do 'gen y = x if period==0' I only get values for y in period '0'.
If -x- is observed just once when -period- is 0, then
su x if period == 0, meanonly
will report on a single observation, and what is
left behind in r(min), r(max), etc. will be the
same value, so following with
gen y = r(min)
will put the same constant in each value of the variable.
-sort-s the observation with -period- 0
to the first observation, then following with
gen y = x
should suffice. Having said all that, there is
some inefficiency in holding the same number
repeatedly. It might be better to hold it in a macro
* For searches and help try: