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

RE: st: RE: Another looping problem


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Another looping problem
Date   Fri, 4 Apr 2003 18:05:25 +0100

Nick Cox
 
> use <datafile>
> sort Country Year 
> cd "P:\IDPM\DBASES\WBFinStruct\tst1" 
> 
> foreach C in <list> {
> 	local OKvars
> 	foreach v of var cba2tfina-region {
> 		qui count if !missing(`v') & Country == "`C'" 
> 		if r(N) >= 35 {
> 			local OKvars "`OKvars'`v' " 
>             }
> 	}
> 	outsheet `OKVars' if Country == "`C'" 
> 		using "Splus`Country'X" , comma replace
> 	outsheet RGDPCap if Country == "`C'" 
>             using "Splus`Country'Y" , comma replace
> }	
 

Last two lines better as 

 	outsheet `OKVars' if Country == "`C'" 
 		using "Splus`C'X" , comma replace
 	outsheet RGDPCap if Country == "`C'" 
             using "Splus`C'Y" , comma replace

Nick 
[email protected] 

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