In the terminal run
apm install stata-exec or go to Settings > Install and search for
This package depends on
language-stata, which you will be prompted to install if needed. There are no additional dependencies needed for use on macOS.
Linux users must install Autokey. On Ubuntu, that's as simple as:
sudo add-apt-repository ppa:troxor/autokey sudo apt update sudo apt install autokey-gtk
You must then link the stata-exec.py file to your Autokey data directory. This is
~/.config/autokey/data/My Phrases by default, so you can add the file to that directory with the command
ln -s ~/.atom/packages/stata-exec/linux/stata-exec.py ~/.config/autokey/data/My\ Phrases/
This only needs to be done once. (Creating a symlink ensures that the script is always the most up to date version.) Additionally, the autokey program must be running for code sending to work. To do this, open up a new terminal and run
autokey-gtk; this process needs to be running each time you run code. (Alternatively, there's an option in Autokey's settings to start the program by default at login.)
Code can be run using either the Command Palette or with keyboard shortcuts. Important: If using macOS, you must first select the flavor of Stata you own. See configuration settings below.
To open the Command Palette, press
ctrl-shift-P, and then start typing
Stata Exec. The available commands will be shown in the drop-down menu.
The following are the default keyboard shortcuts (Mac/Linux). These can be personalized in your
ctrl-enter: send selection or current line to Stata.
shift-ctrl-D: send entire file to Stata. (File must be saved first. This runs
ctrl-alt-p: send the previous command.
shift-ctrl-C: change Stata's working directory to that of current file.
shift-ctrl-G: send paragraph under current cursor. A paragraph is a region enclosed by whitespace.
shift-ctrl-R: send program definition under current cursor. If there exists
program drop on the line before
program define, the line including the former will be included in the selection. For example, all the lines in the below snippet would be sent to Stata:
cap program drop myProgramprogram define myProgram// program contentsend
All configuration can be done in the settings panel (Settings > Packages > stata-exec). The available options are listed below:
ssh username@host -Y, likely followed by
xstata. This package's commands to run the entire do file and set the working directory are not supported on XQuartz.
This package is currently only for Mac and Linux users. Interactive Windows support seems impossible, see issue #4.
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.