Michael has put his finger on the nub
of the matter as usual.
A more long-winded statement can be found at
FAQ . . . . . . . . . . . . . . . . . . . . . . . Replacing missing values
2/03 How can I replace missing values with previous or
following nonmissing values?
http://www.stata.com/support/faqs/data/missing.html
In this case, I happened to know that this FAQ existed but
could not remember its URL. So I -search-ed on missing.
Some rummaging in the files also shows that the keywords
datasets sets missing values previous following replace cascade
cascading nonmissing non
would have produced a hit.
A deeper question is how to start trying to find this when
you do not know what exists. The Statalist FAQ
itself recommends the following sources.
===============
Before posting, consider other ways of finding information:
the manual
the online -help- for Stata
-search- can tell you about all built-in Stata commands, all
ado-files published in Stata Technical Bulletins or the Stata
Journal, and all FAQs on the Stata web site, www.stata.com.
-findit- can tell you about not only all of the above, but also
about user-written Stata programs available on the Internet.
your local Stata expert or technical support person
past issues of the Stata Technical Bulletin or Stata Journal, if accessible
the authors of user-written ado-files (who usually have email
addresses, but are not always members of Statalist)
Stata technical support, if it is really a question for them
=================
I would always recommend using -search- before trying
to search the Statalist archives.
Nick
[email protected]
Michael Blasnik
> replace ID=ID[_n-1] if ID==.
Christopher Berry
> > 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/