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

Re: st: RE: DO file name macro


From   Eddy <[email protected]>
To   [email protected]
Subject   Re: st: RE: DO file name macro
Date   Thu, 22 Jul 2004 04:55:06 -0700 (PDT)

Nick Cox wrote:

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

Now that IS a nice trick! Thanks, Nick!

Eddy


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


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
*
*   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