Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: running StataSE 8.2 with ESS

Subject   Re: st: running StataSE 8.2 with ESS
Date   Wed, 03 Nov 2004 11:12:46 -0600

Tak Wing Chan <> asked:

> I have been running Stata 7 from within Emacs using Emacs Speaks 
> Statistics, and would like to do the same with Stata 8. I have X11 
> (running full screen mode), Emacs, ESS, etc set up on my Mac. Since 
> Stata 8 now lives in the /Applications Folder of Mac, I have built a 
> symbolic link from /usr/bin to Stata as follows:
> ln -s /Applications/Stata/ stata
> This doesn't work, unfortunately. When I invoke Stata from within emacs 
> (by typing M-x stata) my emacs seems to freeze over, and when I switch 
> back to Aqua, there is a message which says "Stata Application is 
> Corrupt! Reinstall Application!", although when I then go to the Stata 
> Data Folder and invoke Stata there, Stata still seems to be working.

For whatever reason, Mac OS X doesn't like symbolic links to GUI applications.
However, there are several ways of doing what you want to do.

The first way is to add /Applications/Stata/ to
your PATH and launch Stata by entering StataSE.

Another way is to create a shell script that launches Stata and passes along
any command-line arguments.  For example:

/Applications/Stata/ $*

This method is ideal because every user would have access to the script rather
each one having to modify their PATH.  You would obviously add an & to the end
of the line if you wish to launch Stata in the background.

Both methods launch a new instance of Stata.  Unfortunately, Mac OS X does not
allow us to change the title of the application on the fly so we have no way
of allowing you to change the title so that you can differentiate each
instance of Stata.  Because windows from different applications can overlap,
it can get down right confusing which window belongs to which instance of
Stata.  For that reason, we don't really recommend running multiple instances
of Stata on Mac OS X.  You can set the preference to have Stata bring all of
its windows to the front when it is brought to the foreground which helps a

You can also launch Stata by entering:

open /Applications/Stata/

However, this method simulates opening the Stata application as if you
double-clicked on it.  This means the current working directory will be set to
the Stata directory which is probably not what you want.  You also can't pass
Stata command-line arguments this way.  The other methods set the current
working directory to the directory you launched Stata from and you can pass
command-line arguments to Stata.

However, there are advantages to using open.  One is that you can use it to
open documents.  For example, to open a dataset in Stata, enter

open /Applications/Stata/auto.dta

This would launch Stata (if it's not already running) and open the file within
Stata.  Stata also automatically changes the current working directory to
the directory a dataset, graph, or do-file is opened from.  Had I entered
open ~/auto.dta, my current working directory would be my home directory in
Stata.  Opening a do-file this way executes the do-file in Stata.

I'm not familiar with Emacs but it would seem that you could use the open
command from within Emacs to open dataset or graph in Stata.  You could
probably get it to execute a do-file you're editing in Emacs as well.

So to summarize.  If you want to just launch Stata, launch multiple instances
of Stata, or launch Stata with command-line arguments (say to execute in batch
mode), use a shell script or add the Stata executable to your path.  If you
want to open datasets, graphs, or do-files within a single instance of Stata,
use the shell command open.

-Chinh Nguyen
*   For searches and help try:

© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index