Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Another looping problem


From   "Joel Clovis" <joel.clovis@stud.man.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: Another looping problem
Date   Fri, 4 Apr 2003 16:32:41 +0000

Hello Satalisters,

I am (some may already know) trying to take a panel dataset and drop 
variables (by Country) that don't have enough observations (at least 35 
say).  I have the following dofile that asks me for another brace and I don't 
know why.  I've used 3 opening and 3 closing.
>{ required
>r(100);


Q1.  Will this dofile achieve my goal?
Q2.  Why do I need another brace? and if so where?

I'm a Stata 7 user.  Can anyone help? 

Joel

Dofile:

foreach Country in  Argentina  Bangladesh  Botswana  
Brazil  Kenya  “Korea, Rep.”  Malaysia  Indonesia   
Ghana   “Taiwan, China”  Tanzania Zambia {
	drop if Country~=`Country' 
	sort Year
	foreach v of var cba2tfina-region{
		qui count if !missing(`v')
		if r(N)<35{
				drop `v'
                  }
		}
outsheet using 
"P:\IDPM\DBASES\WBFinStruct\tst1\Splus`Country'X" , 
comma replace
keep RGDPCap 
outsheet using 
"P:\IDPM\DBASES\WBFinStruct\tst1\Splus`Country'Y" , 
comma replace
use 
"P:\IDPM\DBASES\WBFinStruct\tst1\FinStructSoc.dta", 
clear
	}	


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