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]

st: Re: questions about Emacs and Stata on Mac


From   Neil Shephard <[email protected]>
To   [email protected]
Subject   st: Re: questions about Emacs and Stata on Mac
Date   Fri, 1 Jul 2011 07:33:40 +0100

Kun Yuan contacted me privately, but I am replying to the list in case
it is of wider interest (as per the Statalist FAQ)...

On Thu, Jun 30, 2011 at 9:17 PM, Kun Yuan <[email protected]> wrote:
> Hi Neil,
>
> I found your post about connecting Emacs and STATA very useful. However, I
> still have some difficulty as I am doing this on a new Mac which I am
> learning how to use. Could you please let me know how to do the following
> steps on Mac?
>
> Is the string within the parenthesis after PATH the path for the stata
> application?

This depends very much on where you have installed Stata which I can not know.

I don't have a Mac, nor a copy of the manual "Getting Started with
Stata for Mac" which likely advises on the recommended/default
installation location, but the following page indicates where Stata
may be installed...

http://macstata.blogspot.com/2007/11/step-1-installation-and-working.html

I don't know if Mac's use a Bash shell, but if they do then you would
need to set the $PATH to

PATH="$PATH:~/Applications/Stata/"

One way of checking where stata is installed is to start a terminal and type...

which stata

...and you should be told the location of the Stata executable, if it
is not ~/Aplications/Stata simply substitute this in the above line
for whatever is reported.

This is in part conjecture on my behalf though based on the fact that
OSX stems from the BSD UNIX-like distribution, someone with a Mac
might be able to suggest alternatives.

Neil
>
> BTW, I got Emacs connected with R and it works fine on my Mac.
>
> "I ensure that the path to the directory is present in the $PATH
> environment variable by adding the following line to my ~/.bashrc (I
> also add my local ~/bin/ directory where I have a few scripts, you may
> or may not wish to include this)...
>
> <--- ~/.bashrc --->
> # Additions to system PATH
> PATH="~/bin/:$PATH:/usr/local/stata/"
> export PATH
> <---------------------->
> "
>
> Thank you very much for your help!
>
> Best,
> Kun
>
> ******************************************
>
> st: Re: troubles with ESS and STATA
>
> From      Neil Shephard <[email protected]>
> To      [email protected]
> Subject      st: Re: troubles with ESS and STATA
> Date      Wed, 23 Mar 2011 09:57:46 +0000
>  Francesco emailed me privately but I am responding to the list so that
> the solution is available to all (as is the general etiquette and
> guiding principles in the Statalist FAQ)....
>
> On Tue, Mar 22, 2011 at 10:48 PM, Francesco Sarracino
> <[email protected]> wrote:
>> Dear Mr. Shephard,
>> I'm writing you because of a nasty problem with Stata and Emacs: after
>> some
>> years of stata do-file editing with stata built-in editor I finally
>> decided
>> to move to a better editor and after long consideration I chose Emacs. Now
>> I
>> am able to edit my do files, but no way I can pass them directly from
>> Emacs
>> to Stata. I tried both the ado-mode by Bill Rising and more recently I
>> tried
>> with ESS (that I already know thanks to R). I got almost desperate since
>> everywhere I found only bad news: nobody is able to run do files from
>> Emacs
>> directly in Stata using Linux (Ubuntu).
>> Finally, I found a post by you at the following
>> page: http://www.stata.com/statalist/archive/2010-10/msg00781.html
>> where you state "Under GNU/Linux I can invoke the terminal version of
>> Stata
>> from within Emacs/ESS and send lines of code to the buffer"
>> Do you have any clue on how to solve my problems? it would be of
>> incredibly
>> great help for me!
>
> Firstly this concerns running Stata and Emacs/ESS under GNU/Linux (but
> is likely generaliseable to other *NIX based systems).
>
> I ensure that the path to the directory is present in the $PATH
> environment variable by adding the following line to my ~/.bashrc (I
> also add my local ~/bin/ directory where I have a few scripts, you may
> or may not wish to include this)...
>
> <--- ~/.bashrc --->
> # Additions to system PATH
> PATH="~/bin/:$PATH:/usr/local/stata/"
> export PATH
> <---------------------->
>
> This means that when I type 'xstata' at a command terminal it starts
> up the Stata GUI, or if I type 'stata' it invokes and starts the
> terminal version of Stata within that terminal.
>
> Once thats set up and running Emacs/ESS should automatically be able
> to find the terminal version so after firing up Emacs simply use the
> key-sequence
>
> M-x stata
>
> ...to invoke Stata.  You will be asked which starting data directory
> you wish to start Stata under and off you go.  You can now highlight
> sections of your do-file in the editing buffer and use the usual
> key-strokes to send it to the Stata buffer that is running.
>
> I should point out that I rarely actually work this way unless I'm
> running things on a remote server over ssh.  If I've a section of a
> do-file I wish to run I normally have Stata GUI (xstata) running on
> one desktop and emacs/ess with my do-file on another desktop, I'll
> highlight the section of the do-file I wish to run, flip to xstata and
> use the middle button (mouse wheel if you have one or both left &
> right mouse buttons if not) to paste the code I highlighted into the
> Command window and hit return to run.  Otherwise I just run the whole
> do file with -do foo/bar-.
>
> Hope that helps,
>
> Neil
>
>
> --
> “Truth in science can be defined as the working hypothesis best suited
> to open the way to the next better one.” - Konrad Lorenz
>
> Email - [email protected]
> Website - http://kimura.no-ip.org/
> Photos - http://www.flickr.com/photos/slackline/
>
>
>
>
>

-- 
“Truth in science can be defined as the working hypothesis best suited
to open the way to the next better one.” - Konrad Lorenz

Email - [email protected]
Website - http://kimura.no-ip.org/
Photos - http://www.flickr.com/photos/slackline/

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