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

st: Another looping problem

From   "Joel Clovis" <[email protected]>
To   [email protected]
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

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? 



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

Joel Clovis
*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index