Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Automating a batch of -insheet- and -save- in a do-file


From   "b. water" <[email protected]>
To   [email protected]
Subject   st: Automating a batch of -insheet- and -save- in a do-file
Date   Fri, 16 Dec 2005 13:42:52 +0000

Dear all,

Stata 8.2, Windows XP Pro SP2

I am creating a simple do-file that essentially perform insheet using filename.txt where filename is labelled sequentially from 1-87 e.g. filename1, filename2, filename3, etc... After the file has been insheeted and processed, I want it saved as filename.dta where the filename.dta will be the corresponding text filename i.e. filename1.dta for filename1.txt, filename2.dta for filename2.txt, etc... up to filename87.dta for filename87.txt. Is there a way to shorten what I am trying to achieve rather than copy paste 87 times in the text editor? Below is a truncated list what I am trying to do.

clear
insheet using filename1.txt
.
.(some 'do' routine)
.
save "C:\DATA\filename1.dta", replace
clear
insheet using filename2.txt
.
.
.
save "C:\DATA\filename2.dta", replace
clear
.
.
.
clear
insheet using filename87.txt
.
.
.
save "C:\DATA\filename87.dta", replace

Again, thank you all for advise and help.

Regards,
bw

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar � get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

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