To increase the number of records by 2 years, -expand- by 3:
expand 3
bysort Co year : replace year=year+_n-1
hth,
Jeph
Rajesh Tharyan wrote:
Hi all,
I am trying the do the following. If I have a data set which looks like this
Co year
A 1986
A 1999
B 1987
I want to say increase the observations for each company year by any number
of years I specify. Lets assume expanding by two years.
So the resulting dataset will look like
Co year
A 1986
A 1987
A 1988
A 1999
A 2000
A 2001
B 1987
B 1988
B 1989
I cant set obs or expand by a grouping variable. I was then trying to split
each file into several files first based on levels of co and then levels of
year, then expand , fillinin missing values etc. But that route is making
the process unnecessarily complicated (I think)
Is there a more staright forward way to do this
Any help is valuable
Thanks
rajesh
*
* 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/
*
* 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/