| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Using "outsheet" and foreach again
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/