Bookmark and Share

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: Working with the name of the do file


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Working with the name of the do file
Date   Wed, 1 May 2013 08:41:29 +0100

Good explanation, which shows that different people can use Stata
intensively and have completely different needs.

I don't know precisely how Stata keeps track of what file is currently
being executed, and the answer can be lots of them, given nesting of
ados, dos, and internal code.

But something should be programmable by you regardless. -filei- (SSC)
shows that you can easily add lines to the top and bottom of files.
Looping over files to change them systematically is the next step. I
know that -filei- may not be your exact answer, but the principle of
using -file- to read and write files sounds enough to automate file
manipulation.

Nick
[email protected]


On 1 May 2013 02:10, Eric DeRosia <[email protected]> wrote:
> Nick wrote:
> "Why would this make a .do file easier to use and maintain?"
>
> Because it would obviate the need to manually edit a do file to rename the
> log file (and similar tasks, as shown in the example in my OP).  In terms of
> workflow, manual editing is inefficient and, more importantly, it is an
> opportunity for errors (e.g., data-entry mistakes) to enter into the
> process.
>
> This functionality would not be useful in every situation, but it would have
> been a handy tool for some situations.  When a SAS code file is run in batch
> mode, the default name of the log file it creates is <name of the SAS code
> file>.log.  That's something I miss about SAS (probably the only thing I
> miss about SAS).
>
>
>
> Daniel wrote:
> "Old, but maybe this helps:
> http://www.stata.com/statalist/archive/2007-08/msg00556.html";
>
> Thanks, Daniel, for pointing me to that post!  I didn't find it in my
> searching.
>
> The post suggests passing the filename as an additional parameter each time
> the do file is called, but I don't think that work-around would make my
> workflow easier or less prone to mistakes.  Oh well, at least I know I'm not
> the only one who has wished for this functionality.
>
>
> - Eric
>
>
> Eric DeRosia, Ph.D.
> Assistant Professor
> Business Management
> Marriott School of Management
> Brigham Young University
> 671 TNRB
> Provo, Utah 84602
> (801)473-5051
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index