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

RE: st: RE: DO file name macro


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: DO file name macro
Date   Thu, 22 Jul 2004 12:45:05 +0100

Perhaps you can this by indirection: 

--------------------- mydo.do 
log using `1' 
di "`2'" 
do `2' 
---------------------

Thus 

mydo mylog.txt example.do 

is interpreted as 

log using mylog.txt 
di "example.do"
do example.do 

Use " " to bind filenames with spaces. 

Nick 
[email protected] 

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Eddy
> Sent: 22 July 2004 12:34
> To: [email protected]
> Subject: Re: st: RE: DO file name macro
> 
> 
> Nick Cox wrote:
> 
> > I don't know of any such built-in, 
> > but I must be missing something. It 
> > is surely about as much typing to do the 
> > specific 
> 
> > di "example.do"
> 
> > as to do this by some general code, 
> > even if that existed. 
> 
> Oh, thanks for the nice trick. Seriously, my specific need is due to
> the fact that I usually have a set of similar DO files that do
> similar work, and it will save time and unnecessary hassle if such a
> macro exists -- too bad it doesn't.
> 
> Eddy
> 
> 
> > Eddy
>  
> >> Is there a built-in macro that register the name of the DO file
> that
> >> is currently running? I wish to use it to print the file name to
> the
> >> session log, so that when I looked at the log next time, I'll know
> >> which DO file was used to generate the results.
> >> 
> >> That is, what I need is something like the (bogus) $FileName macro
> in
> >> the following example, which should take the value of "example.do"
> >> (with or without file path). Thus, when I open mylog.txt months
> >> later, I'll know it is the result of running example.do.
> >> 
> >> ====== example.do ==========
> >> capture log close
> >> log using mylog.txt
> >> 
> >> di "$FileName"
> >> 
> >> .......
> >> 
> >> ============================
> >> 
> >> Forgive my ignorance if the question has been asked before -- I
> >> searched but couldn't find the answer.
> 
> > *
> > *   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/
> 
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail 
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index