Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: repeating first x values


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: repeating first x values
Date   Mon, 12 Sep 2011 17:04:19 +0100

bysort id (alpha) : replace alpha = alpha[1]

will work with your example. See also

FAQ     . . . . . . . . . . . . . . . . . . . . . . . Replacing missing values
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        2/03    How can I replace missing values with previous or
                following nonmissing values?
                http://www.stata.com/support/faqs/data/missing.html


2011/9/12 Gabriel Nicolás Michelena <hmg@mrecic.gov.ar>:

> I will be specifc. I have this dataset
>
>  alpha    id    id2
> .00474     1     1
> .00062     2     1
> .035085    3     1
> .035085    4     1
> .035665    5     1
>   .       1     2
>   .       2     2
>   .       3     2
>   .       4     2
>   .       5     2
>
>
> and i want to replace the missing values in alpha (in id2=2) repeating the values of variable alpha in id=1
>
> some clue how can i do it?
>

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index