Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: 64 bit Stata for the Mac /feature request


From   Christopher Intemann <[email protected]>
To   [email protected]
Subject   Re: st: 64 bit Stata for the Mac /feature request
Date   Tue, 17 Jun 2008 11:29:18 +0200

Hello Daniel
Am Jun 16, 2008 um 7:20 PM schrieb Daniel Stegmueller:

Christopher,

communicating with Stata from ESS is quite easy using applescript.

This is what I have in my .emacs file. It creates an (invisible) file in your user folder containing your selected code which is subsequently run by Stata.
Just assign a key to the function (I use F4) and the whole process becomes quite convenient...


Daniel


(defun ado-to-Stata ()
(interactive)
(clipboard-kill-ring-save (point) (mark))
(do-applescript "try \r tell application \"Finder\" \r set TmpDo to (((path to home folder) as text) & \".temp.do\") \r set theContents to the clipboard \r if not (the last character of theContents = return) then \r set theContents to theContents & return \r end if \r end tell \r try \r set the open_target_file to open for access file TmpDo with write permission \r set eof of the open_target_file to 0 \r write theContents to the open_target_file starting at eof \r close access the open_target_file \r on error \r try \r close access file TmpDo \r end try \r end try \r tell application \"StataSE\" \r activate \r open file TmpDo \r end tell \r on error error_message number error_number \r return \"Error: \" & error_number & \". \" & error_message & return \r end try"))

P.S.: The "tell application \"StataSE\" \r activate" part brings up StataSE. You may need to adjust it.


Thank you very much. This does exactly what I was looking for.

If Stata Corp. would now change the results window in the next release/patch to support area selection, I'd be totally satisfied:-)

Regards,
Chris







Hello to all,
thank you very much for all your comments about do-file/ texteditors.
I wasn't aware that stata is capable to handle apple events.
As I'm not familiar with apple script - is there a good ressource explaining how to use apple events
with emacs (or any other external editor)?
Regarding emacs, I'm currently using the ESS extension (http://stat.ethz.ch/ESS/ ), which does not
offer stata interoperability. Or, at least I coudn't figure out how to use it.
The ado-mode page (http://www.bellarmine.edu/content/about/faculty/wrising/Stata ), which is linked
from http://fmwww.bc.edu/repec/bocode/t/textEditors.html, seems to have disappeared.
Is it mirrored somewhere?

However, this is not the only issue to solve.
The other thing is the exporting/ extraction of results.
Most OS X applications support the "Alt"-key when marking text.
For instance, with "Unphased", which is running in terminal.app, it is possible to mark a distict
area of the text, like an individual column, an copy&paste it.
(http://creativebits.org/mac_os_x/free_text_area_selection)
I REALLY miss this functionality in the stata results window, and I would like to strongly encourage the Stata
developers to include it in their next release.
Thanks,
Chris


Am 15.06.2008 um 15:36 schrieb Phil Schumm:


On Jun 14, 2008, at 11:18 AM, Christopher Intemann wrote:
For instance, I'm writing my scripts using emacs in stata mode. However, there is no way to run them (or parts from them) directly from emacs. It would be nice if the upcomming stata release would offer an interface for external editors.

If all you want to do is to run the file you're editing (or selected portions of it) in Stata, then you can use an "Open" Apple Event to do this. For more information, see the section on Macintosh editors in http://fmwww.bc.edu/repec/bocode/t/textEditors.html . I'm not an emacs user, but IIRC, it has a "do-applescript" command that you can use for this; I thought it had been incorporated into Bill Rising's Stata mode for emacs, but perhaps not. I have used this approach with AlphaX (and now TextMate) and it works quite well.

In fact, with the OS X executable update dated 25feb2008, this approach now works even better. Prior to that, when Stata had finished processing a file it would notify you via OS X's notification system (i.e., bouncing icon in the dock), and wouldn't accept any further requests until you had responded to the notification by switching focus to Stata. After the update, Stata no longer waits to accept new requests, and there is a preference item so that you can disable notification all together. These changes make working with external editors on OS X much nicer.

The question of whether StataCorp should add features to its do- file editor has been addressed several times before on the list. As several have noted, many of the users who find it inadequate would also find inadequate any editor except their preferred one. These users want to be able to use the same text editor for everything (e.g., data-analytic work, coding, writing, etc.), and have invested considerable effort in learning how to use their text editor efficiently and/or customizing it to suit their needs. StataCorp may decide to add features to their do-file editor in the future (since, clearly, there are a lot of users who use it), however my suggestion would be to take your preferred editor and figure out how to use it well with Stata; that way, you'll be happy whatever StataCorp does.


-- Phil

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
Daniel Stegmueller
Landgrafenstr. 14
60486 Frankfurt a.M.
069/24140381
[email protected]




*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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