Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: create a variable using the first value in time-series data by group


From   PKCHEN UMD <pkchen@umd.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: create a variable using the first value in time-series data by group
Date   Mon, 10 Jun 2013 21:33:41 -0400

Hello Statalist,
I have a time-series cross sections dyad-year dataset. I run the
regression and create the prediction variable for each observation. I
want to take the prediction of the first year of each dyad and times
1.3. There is one number for the beginning year of every dyad. Then I
want to compare the rest of years of prediction with the beginning
year. My goal is to create a dummy variable that is 1 if any yearly
prediction for that dayd is more than 1.3*the beginning year
prediction.

I manage to create a variable that contains the 1.3*the first year
prediction using by dyad: gen. But I can only tell stata to fill in
the value of the beginning. The rest of yearly observations are coded
as missing. Is there a command that can autofill the missing value
with the first year prediction I create? Or is there a more succinct
way to create the dummy variable I want?

Thank you very much!

--
Ping-Kuei Chen
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index