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/