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

RE: st: Data Expansion Question

From   "Lektzian, David" <[email protected]>
To   <[email protected]>
Subject   RE: st: Data Expansion Question
Date   Thu, 31 Jan 2008 12:17:11 -0600

Thanks, Scott.  That was exactly what I needed.  The only thing I was
not sure of was the purpose of the last line 1, sepby(id).  I ran that
line, and the data looks fine.  I just was not sure of what that line

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Scott
Sent: Thursday, January 31, 2008 11:12 AM
To: [email protected]
Subject: Re: st: Data Expansion Question

Take a look at -expand-

For example:

input id    duration     count      year
1                            4          1         1990
2                            3          1         1995
expand dur
bysort id: replace year = year +_n -1
by id: replace count = _n
l , sepby(id)


On Jan 31, 2008 10:58 AM, Lektzian, David <[email protected]>
> Dear Statalist,
> I have a question regarding the expansion of a cross-sectional
> time-series dataset that I am working with.  Basically, I have cases
> with an indicator of the duration of the case in years.  I would like
> expand this data out so that there is a separate observation for each
> year that the case existed.  I would also like to include a count of
> which year the case is in, and a year variable tracking the year.
> anybody help me with the creation of a simple do file that would
> the data?
*   For searches and help try:

*   For searches and help try:

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