Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: FW: generate observations by group/levels


From   "Rajesh Tharyan" <R.Tharyan@exeter.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: FW: generate observations by group/levels
Date   Sun, 20 May 2007 15:44:21 +0100

________________________________________
From: Rajesh Tharyan [mailto:R.Tharyan@ex.ac.uk] 
Sent: 20 May 2007 15:37
To: 'statalist@hsphsun2.harvard.edu'
Subject: generate observations by group/levels 

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/



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