Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Using "outsheet" and foreach again


From   "Riano, Juanita" <[email protected]>
To   <[email protected]>
Subject   st: Using "outsheet" and foreach again
Date   Wed, 19 Apr 2006 14:19:08 -0400

Dear all, 

I am still facing problems with the outsheet and foreach commands. 

Nick gave me a good solution except that my outsheet files don't use
numbers. My inputs are 15 datasets labeled as oilgs.dta chmcl.dta ... 
And I need to have 15 excel files with the same name plus the prefix bra
(ie  braoilgs.xls  brachcml.xls....)

This is what I have so far:

foreach x in  oilgs chmcl bresr indgs fdbev perhh hlthc rtail media
trles telcm utils banks insur finsv {
foreach file in oilgs chmcl bresr indgs fdbev perhh hlthc rtail media
trles telcm utils banks insur finsv {
use `file', clear
outsheet using bra`x'.xls , replace
}
}

However this keeps saving the first dataset "oilgs.dta"  under  15
different names braoilgs.xls brachmcl.xls 

I'd appreciate your suggestions 

Thank you!

 

---------------------------------------------
Juanita Riano
International Monetary Fund
Research Department
[email protected]
phone 202-623-5437


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