Skip to content
vikjam edited this page Feb 13, 2022 · 23 revisions

This page contains some tips and suggestions for the various languages used in this repository.

Stata

The simplest way to use Stata is simply to use the app. If you prefer to not use the do-file editor that comes with Stata, your text editor of choice will probably have some support for Stata syntax and possibly additional features. For example, Sublime Text has a couple of packages, Sublime Stata Enhanced and Stata Editor. See the Sublime Text tips below for details. It is also possible to interact with Stata from the command line by installing the command line tools. You can then invoke Stata with the command, stata-se (or something similar based on your version of Stata). In order to use Stata from the command like you'll likely need to click "Install Terminal Utility..." in the Stata app once.

R

You can use the app accompanied with your R installation, but it is generally advisable to use an improved R IDE such as RStudio or Microsoft R Open, which are both free to use. R can be invoked from the command line via the command R (if you use R from the command line, you should consider installing radian for a better command line experience). See below for Sublime Text support.

Python

There are many ways to get started with Python. A simple approach for people interested in using Python for data analysis is to install Anaconda. For interacting with Python, many find Jupyter notebooks to be useful. For individuals coming from Stata, R or Matlab, an IDE like Spyder may feel familiar.

You can also install everything via command line tools.

Installing Python without an IDE

macOS

You already have Python installed on macOS, but it's best to get the latest version of Python and not mess around with your system Python. One way is to use a Python manager such as pyenv, which you can install with Homebrew:

brew update
brew install pyenv

Make sure to follow the instructions on pyenv for adding shims to your .bash_profile or .bash_rc. It's helpful to use something like the Scipy Superpack to install all the libraries used in Python for data analysis.

Julia

Julia does not come with much of interface. The VS Code plugin for Julia provides an IDE-like setup for using Julia. IJulia provides another alternative to interacting with Julia. Quantitive Economics has a nice guide to setting up Julia. Also, checkout the Wikibooks guide about getting started with Julia (in particular, the advice on how to invoke Julia from the command line).

Reading Stata files into Julia

ReadStat provides the ability to read Stata files directly into Julia. In order to install it, you'll first need to install some dependencies.

macOS

With macOS, you can install the necessary dependencies with the following:

brew update
brew install ragel libiconv
git clone https://github.com/WizardMac/ReadStat.git
cd ReadStat
make
sudo make install

Then you can install DataRead in Julia,

Pkg.clone("https://github.com/WizardMac/DataRead.jl.git")

Alternatively, StatFiles extends FileIO to import SAS, SPSS, and Stata files.

Editing Code

Jupyter Lab

Jupyter Lab has become a popular interface for working with Jupyter notebooks.

Kernels

The impetus for Jupyter notebooks was Python, but you can install additional "kernels" so that you can use with Stata, R or Julia in a Jupyter notebook.

Useful extensions for Jupyter Lab

Miscellaneous

  • Checkout this Medium post by Towards Data Science on additional features.