If you want a version of -do- (renamed appropriately) that creates the
log file (named appropriately), then download the -dolog- package from
SSC by typing
ssc desc dolog
ssc inst dolog, replace
If you then type
dolog mydofile
then Stata will execute -mydofile.do- and output the results to
-mydofile.log- (as well as echoing them to the Results window).
I hope this helps.
Roger
Roger Newson
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/pop
genetics/reph/
Opinions expressed are those of the author, not of the institution.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Austin
Nichols
Sent: 16 August 2007 17:18
To: [email protected]
Subject: Re: st: Does a do file know its own name?
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) <[email protected]> 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/
*
* 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/