Skip to content

Install

Maximiliano edited this page Jun 9, 2021 · 5 revisions

Installation and basic settings

The stata_linter package requires Python to properly detect and correct bad coding practices. The package runs Python behind the scenes.

Requirements

  • Python 3
    • Packages (modules):
      • openpyxl
      • pandas
  • Stata 16 or higher

Python

If you do not have Python already installed, you can either download it from Python's website, through anaconda, or ninite for Windows, or Homebrew for MacOS.

First, you can verify that Python is installed on your system by typing on Stata:

python query

You can refer to this blog post for more information on Stata/Python integration.

After you have installed Python and you have identified the version you have, you have to make sure you have pandas and openpyxl installed. In Stata, you can run the following commands to check the status of the python modules:

python which pandas
python which openpyxl

If the modules are installed, you should get a path directory. If you have problems installing the modules, plese refer to this blog post.

Stata

Since the introduction of Stata 16, we can now invoke Python from Stata. Therefore, if you are using a lower version, unfortunately you won't be able to run the stata_linter package. For more documentation about Stata/Python integration visit this link.

How to install this package?

After you have checked all the requirements above, you can install the stata_linter package by running the following code on Stata:

net install stata_linter, from("https://raw.githubusercontent.com/worldbank/stata-linter/master") replace

The code above installs the version in the master branch of the repository. If you want to install unpublished branches, replace master in the URL below with the name of the branch you want to install from. After this, you are all set and can start detecting and correcting bad practices in Stata.