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: Stata 11 v Stata 12: difference in batch mode behaviour


From   [email protected]
To   [email protected]
Subject   Re: st: Stata 11 v Stata 12: difference in batch mode behaviour
Date   Wed, 05 Oct 2011 11:56:39 -0500

Dave Ewart <[email protected]> wrote:
> In the following, I use 'stata11' as a command to mean Stata 11's
> 'stata' and 'stata12' for Stata 12's 'stata.  Both are running on Linux.
>
> I noticed when testing Stata 12 that a previously-working batch job was
> failing.
>
> The old job was launched as follows:
>
>     stata11 -b something.do
>
> and it put correct output into something.log
>
> But,
>
>     stata12 -b something.do
>
> fails and puts output like the following into an output logfile called
> stata.log:
>
>        . doedit something.do 
>        unrecognized command:  doedit
>        r(199);
>
> Very strange?  It's launching 'doedit' against the supplied DO file?
>
> Then I realised that perhaps I've been playing against the rules all
> these years and found that I should actually have been using
>
>     stata11 -b do something.do
>
> (that is, include the 'do' command).  However, Stata prior to Stata 12
> has previously taken a simple DO file parameter as a file to be executed
> with 'do'; Stata 12 appears to be trying to 'doedit' it instead.

It was fortuitous that 'stata11 -b something.do' worked in the
way that Dave described.  The correct syntax for batch mode is
'stata11 -b do something.do'.  The reason this worked is that
Stata, when presented with a filename on the command line,
attempts to determine what the proper command is to execute for
that filename based on its extension.

We did change the default behavior of how the '.do' file extension
is handled in Stata 12.  Previously, Stata would interpret the .do 
extension and insert the -do- command before the filename.  In Stata 12 
the interpretation was changed so that the default action is now -doedit-.
This change was made because we received significant user feedback that
their preferred behavior was to edit a do-file when they double-clicked 
on a filename or if they dragged and dropped the file onto Stata.  This 
is significant because the mechanism that Windowed environments use to 
process double-click or drag and drop behavior is to pass the filename
to the application and then the application must determine how to handle
the file, and that is exactly how command line arguments are processed.

As Dave has already suggested, the proper way to call a do-file
from the command line is to specify -do- before the filename.

-- James
   [email protected]


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


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