Statalist The Stata Listserver


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

st: RE: RE: Using "outsheet" and foreach again


From   "Riano, Juanita" <JRiano@imf.org>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Using "outsheet" and foreach again
Date   Thu, 20 Apr 2006 11:40:40 -0400

Thank you Rajesh and Jennifer for your help!

Best

Juanita 


---------------------------------------------
Juanita Riano
International Monetary Fund
Research Department
jriano@imf.org
phone 202-623-5437

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Rajesh
Tharyan
Sent: Thursday, April 20, 2006 11:38 AM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Using "outsheet" and foreach again

Hi,

This should work

foreach file in decilenopur decilenosell { outsheet using bra`file'.xls,
comma replace }

Here I tried using my own files decilenopur and decilenosell and it does
work..

Regards
rajesh


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Riano,
Juanita
Sent: 19 April 2006 19:19
To: statalist@hsphsun2.harvard.edu
Subject: 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
jriano@imf.org
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/

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

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