Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: appending time periods


From   "Olexandr O. Vasetsky" <[email protected]>
To   [email protected]
Subject   Re: st: appending time periods
Date   Sun, 31 May 2009 01:00:20 -0600 (MDT)

Hi,

to fill your indep3 dummy you can use something like this (might need to
"ssc install gsort" first):

sort panelid timevar
by panelid:  replace replace indep3 =  indep3[_n-1] if  indep3== ""
gsort panelid -timevar
by panelid:  replace replace indep3 =  indep3[_n-1] if  indep3== ""
sort panelid timevar

this program fills ALL the blanks for the indep3 - i.e those after the
existing observation (like in your example) as well as blanks BEFORE the
existing one, in case you have to fill it in both directions.

Cheers,

Olex


> Dear All:
>
> I am working on a panel dataset. Couple of variables varies overtime
> and across panels, others only vary across panels. Got some additonal
> data for time & panel varying variables, for new time periods. I would
> like append the new observations to the panel and then within each
> panel ensure the records for panel only variables are applied to them
> (i.e. no blanks).
>
> example:
>
>               panelid     timevar     dep     indep1 indep2
> indep3(dummy)
>                  1          1/1/2000    321      899     12
>  1
>                  1          2/1/2000    882      980     34
>  1
> add=>        1         3/1/2000     698      898     87    (here I
> want the above value to apply instead of a blank)
>
>                  2         1/1/2000      338      768    90
>
>
>
> thanks,
> Max
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
>
>


-- 
Sincerely,

Olexandr Vasetsky
Graduate student
Department of Economics
University of Calgary

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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