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" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
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 
n.j.cox@durham.ac.uk 

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