Statalist The Stata Listserver


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

RE: st: RE: loop to fill in missing observations


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: loop to fill in missing observations
Date   Fri, 15 Jun 2007 18:08:10 +0100

Correct. Thanks for the catch. 

My guess is also that a -fillin- approach at most needs
some extra observations being added. This is explained in

SJ-5-1  dm0011  . . . . . . . . . . . . . .  Stata tip 17: Filling in the gaps
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q1/05   SJ 5(1):135--136                                 (no commands)
        tips for using fillin to fill in gaps in a rectangular
        data structure

Nick 
[email protected] 

Carole J. Wilson
 
> Fabrizio,
> 
> I think the replace commands should read:
> 
>                       replace countryn = `x' in l
>                       replace year = `y' in l
> 
> (no double ==) in Nick's post.
> 
> --Carole
> 
> On 6/15/07, Nick Cox <[email protected]> wrote:
> > qui forval x = 1/28 {
> >        forval y = 1975/2002 {
> >                count if countryn == `x' & year == `y'
> >                if r(N) == 0 {
> >                        set obs `= _N + 1'
> >                        replace countryn == `x' in l
> >                        replace year == `y' in l
> >                }
> >        }
> > }

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index