Statalist


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

Re: st: Does a do file know its own name?


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Does a do file know its own name?
Date   Thu, 16 Aug 2007 12:17:30 -0400

Jane--
As far as I know, no.  This would be a natural addition though, and I
have heard at least one request for this at Users Group meeting.

Try
  creturn list
to see where a section on "Currently running" or somesuch would be
natural, with perhaps:
            c(dofilename) = ""
            c(dofilepath) = ""
            c(adofilename) = ""
            c(adofilepath) = ""

One workaround for do-files is to create your own versions of -do- and
-run- (renamed appropriately) that create the log file and then -do-
or -run- the do-file.  Another option is to use batch-mode processing
which creates a do-file of the same name by default, and also runs a
whole lot faster.

On 8/16/07, Skinner Jane Dr (MED) <Jane.Skinner@uea.ac.uk> wrote:
> Hi
>
> Is there any way of obtaining the string "MyDoFile" programmatically
> from within MyDoFile.do?  I would like to write to a log file with
> the same name (different extension, obviously) in a way that is
> robust to renaming or copying the do file, amongst other things.
>
> Thanks,
>
> Jane
*
*   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