[ESS] how to use Stata in Emacs (with ess)

Vitalie Spinu @p|nuv|t @end|ng |rom gm@||@com
Wed Sep 9 14:37:00 CEST 2015


>> On Wed, Sep 09 2015 05:09, ollie_m wrote:

> Vitalie Spinu-2 wrote
>> The stat program name is configured in inferior-STA-program-name variable
>> which is by default "stata". So, either you should point that variable to
>> stata process. Or add the directory with your stata.exe to your Path
>> variable and restart emacs.

> As I understand it, the value of the inferior-STA-program-name variable
> should be the name of the Stata program, so I changed the variable name to
> StataSE, 

I am not sure this is the right thing. I am not a stata user so I don't know.

The program that you pointed to should be runnable in terminal. If you can run
StataSE in terminal, you should (in principle) be able to run it inside emacs.

> and I added my Stata program folder (D:/Programs/Stata) to the system path.

You could have simply set inferior-STA-program-name to the full path like
D:/Programs/Stata/stata without adding the directory to the path.

> Now when I highlight some lines and C-x C-r, Emacs, like always, asks me
> "Starting data directory?" after I give it my directory, instead of running
> the code in Emacs, it starts my Stata (in its own window) and does nothing,
> and Emacs freezes and I have to force close the window.

You are almost there. Before running any code you need to start an inferior
process such that ESS can communicate with it. This is why you are asked for the
directory when you evaluate the code for the first time.

The problem is that you seem not to be running the right program.

Open emacs shell (M-x shell) then look for other executables in the stata folder
and try to run those inside the shell. Whichever works, point
inferior-STA-program-name to it and you should be fine.


  Vitalie




More information about the ESS-help mailing list