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" <>
To   <>
Subject   st: FW: generate observations by group/levels
Date   Sun, 20 May 2007 15:44:21 +0100

From: Rajesh Tharyan [] 
Sent: 20 May 2007 15:37
To: ''
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


*   For searches and help try:

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