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   "Carole J. Wilson" <[email protected]>
To   [email protected]
Subject   Re: st: RE: loop to fill in missing observations
Date   Fri, 15 Jun 2007 12:01:29 -0500

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