Stata and GitHub Integration

Asjad Naqvi
The Stata Guide
Published in
13 min readApr 27, 2021

--

Last updated: October 2022

In this guide learn how to use syntax-based synchronization to GitHub directly from Stata using Git.

Why is this necessary? More and more projects are moving online and data sharing is now commonplace. In economics and other fields, having some online repository with data and code for replication is also becoming a norm. While some websites and journals provide their own platforms for data sharing, GitHub is now also slowly gaining traction as a hosting service. Furthermore, GitHub excels are two services that other online data sharing platforms lack: version control and the seamless ability to collaborate with code writing.

Additionally, on GitHub one can also follow other code development projects, access data sets, and set up interactive websites using a whole suite of languages which have the ability to showcase functionality of the code. And a plus point is that all of this is free of cost.

Preamble

Like other guides, a basic knowledge of Stata is assumed. In order to make the graphs exactly as they are shown here, several additional item are required:

ssc install schemepack, replace

Use can use any scheme from the suite. For example, let’s set “black_w3d”:

set scheme black_w3d
  • Set default graph font to Arial Narrow (see the Font guide on customizing fonts)
graph set window fontface "Arial Narrow"

Narrower fonts work better for longer texts.

Introduction to GitHub

Before we start, the first step is to set up a GitHub account:

This is fairly straightforward. Here I would suggest that as you put more and more stuff online, switch to two-factor authentication to boost the account security.

--

--

Asjad Naqvi
The Stata Guide

Here you will find cool stuff on Stata and data visualizations.