Statalist The Stata Listserver


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

RE: st: Data Manipulation Question


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Data Manipulation Question
Date   Sun, 19 Nov 2006 17:23:57 -0000

This is an FAQ.  

replace Parent = Parent[_n-1] if missing(Parent) 

would work in this example. 

More generally, see 
How can I replace missing values with previous or following nonmissing values?
How can I replace missing values within sequences?
http://www.stata.com/support/faqs/data/missing.html

Bob Yaffee's approach based on pretending that this is a panel 
data set can thus be avoided. His further suggestion of
using -destring- wouldn't work, as -Parent- has no numeric 
interpretation,  and is also unnecessary, as the logic of 
the device above applies to both numeric and string variables. 

Nick 
n.j.cox@durham.ac.uk 

Socrates Mokkas 

> I have a question related to data manipulation. My data sample is
> like that:
> 
> Parent       Subsidiary
> A            B
>              C
>              D
>              F
> X            J
>              L
> Z            T
> 
> What I want is to fill the gaps of the ParName.

*
*   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