Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: filling in gaps


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: filling in gaps
Date   Wed, 19 Oct 2005 13:05:28 -0400

replace ID=ID[_n-1] if ID==.

Michael Blasnik
michael.blasnik@verizon.net
----- Original Message ----- From: "Christopher Berry" <crberry@uchicago.edu>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wednesday, October 19, 2005 12:55 PM
Subject: st: filling in gaps



I'd like to know if anyone can suggest a solution to the following problem. I have a data set with multiple observations on federal programs. However, the program ID is only given for the first observation of a program, and then is blank. The file looks like this:

ID VAR1
10.001 1973
1813
1654
10.002 5623
4158
10.003 6639 ....
I would like to fill in the gaps in the program IDs. In this case, rows 2 and 3 should be set 10.001, and row 5 should be set to 10.002. I should note that I have about 12000 rows of data. Program IDs are not necessarily sequential. There is not always a gap between program IDs; that is, a program may have only one row of data. Can anyone suggest a solution to this problem? I haven't found anything by searching the archives, although I confess that I'm not sure what the right search terms might be. Thanks.
*
*   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