Program to set up StataEditor (a package of Sublime Text) automatically
sublime automates the installation process of StataEditor, a Sublime Text package enabling Stata users to interactively send code to Stata from Sublime Text. After getting StataEditor and Pywin32 via Package Control, to run Stata and execute this command will finish the setup of StataEditor.
What does sublime do for you in detail? sublime automatically detects the version of current Stata session, locates Sublime Text directory, writes the settings file for StataEditor and registers the Stata Automation type library. Note that you might have to run Stata as Administrator to register the Stata Automation type library.
You can install the latest version of sublime using either Stata’s net install command or user-written package github.
net from https://raw.githubusercontent.com/jh-min/sublime/master
github install jh-min/sublime
Current version of sublime is also available on SSC archive.
ssc install sublime , replace
StataEditoropens new Stata session every time and does not send code to Stata!
This problem lies in the failure to register the Stata Automation type library. If you are using Windows 10, please execute
sublimewithStata running as Administrator. If you are using Windows 7/8/Vista, you might need to follow the Windows Vista instruction which can be found here.
sublime [, options]
| otpions | Description |
|---|---|
| installed | set StataEditor assuming Sublime Text has been installed on user’s system |
| portable | set StataEditor assuming the path to portable version of Sublime Text has been stored with whereis |
| keepwhereis | force sublime not to remove the entry named Sublime from whereis |
| manually | write the settings file for StataEditor in current working directory |
By default, sublime will assume that you are using portable version of Sublime Text and locate the directory of Sublime Text by retrieving the path stored with SSC package whereis. If sublime fails to locate the directory of portable version, it will assume that Sublime Text has been installed on your system and depend on environment variable to locate the directory. Then sublime will write the settings file for StataEditor in that directory.
If installed is specified, sublime will not depend on whereis even if you have stored the path to Sublime Text with whereis.
If portable is specified, sublime will not locate the directory of installed version even if you have installed Sublime Text on your system. To specify this option, you should first install whereis from SSC archive and then create an entry named Sublime to store the location of portable version as follows:
whereis Sublime "path/to/portable version/sublime_text.exe"By default, if you have specified portable while the path stored with whereis is indeed not the location of portable version, sublime will automatically remove the entry named Sublime from whereis. If you don’t want this behavior, specify keepwhereis.
If manually is specified, sublime will not locate the directory of Sublime Text and just write the settings file for StataEditor in current working directory. You might manually move this file to your Sublime Text directory to set StataEditor.
JeongHoon Min, Sogang University, plus1@sogang.ac.kr
The author is grateful to Germán Rodríguez for the whereis program.