Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Stata 11 v Stata 12: difference in batch mode behaviour

Subject   Re: st: Stata 11 v Stata 12: difference in batch mode behaviour
Date   Wed, 05 Oct 2011 11:56:39 -0500

Dave Ewart <> 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
> and it put correct output into something.log
> But,
>     stata12 -b
> fails and puts output like the following into an output logfile called
> stata.log:
>        . doedit 
>        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
> (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' worked in the
way that Dave described.  The correct syntax for batch mode is
'stata11 -b 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

*   For searches and help try:

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