Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Fill


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Fill
Date   Fri, 26 Feb 2010 16:50:04 -0000

If that's the answer, there is supporting discussion at 

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

Nick 
[email protected] 

Scott Merryman

Like this?

clear
input id decile	year
1	1	1999
2	6 	1999
4	9	1999
4	.	2001
2	.	2001
1	.	2001
2	.	2002
end

bys id (dec): replace dec = dec[_n-1] if dec ==.
sort year dec
l

On Fri, Feb 26, 2010 at 6:45 AM, Tiago Fonseca
<[email protected]> wrote:

> How can I solve this problem. I have a set of data like these:
> Industry code
>        Decile
>        Year
> 1
>        1
>        1999
> 2
>        6
>        1999
> 4
>        9
>        1999
> 4
>        .
>        2001
> 2
>        .
>        2001
> 1
>        .
>        2001
> 2
>        .
>        2002
>
>
> I have a industry code, the decile of the base year (1999) and I want to
> fill the decile in the remaining years. The solution will be like:
> 9
> 6
> 1
> 6
>
> How to solve it for a large set of data?

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index