Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: Accessing and using *.do file filename
From
"Seed, Paul" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: Accessing and using *.do file filename
Date
Thu, 23 Jun 2011 11:18:34 +0100
Nancy Briggs <[email protected]> asked :
>>I am looking for a way to capture the name of the *.do file I am currently
>>using so I can display it in the
>>output file I create. c(filename) returns the most recent data file, and
>>dir *.do does list the *.do files in the current directory, but I can't seem
>>to extract the current *.do file's name.
The simplest way is to include the do file's name as a comment
immediately after you open the log file.
An alternative approach (and much more convenient) is to
always give the log file the same name as the do file.
All this (and more) can be stored in standard file dummy.do,
which can be quickly opened, revised using search & replace & then saved
at the start of any job.
***********************
* dummy.do
* Written : ...
* Purpose: ...
version 11
cap log close
log using dummy.txt, text replace
set more off
cap prog drop dothis
prog define dothis
***********************
* You stuff goes here
***********************
end dothis
dothis
log close
set more on
exit
***********************
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/