Archives for posts tagged ‘Stata’

Regex, sql files, and panel data recoding on Statabytes

I’ve written three posts for my blog on Stata in the last month or so. One includes a neat little trick to use regex commands to shorten -if- statements after a command run either interactively or in an do-file. I like this trick because it can be particularly helpful when you are trying to find [...]

New Stata blog

Lately many of my posts have involved the Stata programming language. I think that the amount I’ve been blogging about Stata warrants a blog of it’s own to separate these from other topics that I cover. So, starting today you can find my writings on Stata tips and tricks at my a new blog Statabytes. [...]

Using -levelsof- to future-proof a loop through factorial variables in Stata

Stata’s -levelsof- command was a solution to a problem I encountered the other day when I had to write a script that looped through a dataset and was one that I previously didn’t know about. In general, I feel that if you find yourself making looping through observations in a dataset or creating many nested [...]

First shot at grabbing data from web APIs using Stata

I love the new World Bank data site. The site makes finding and downloading data from the World Development Indicators very easy. But, I dream of searching the World Bank databases and downloading datasets directly into Stata all without leaving my Stata terminal. The World Bank offers an API for it’s data that has already [...]

Download and unzip data files from Stata (Linux/Windows)

Recently, I’ve been using Stata’s -shp2dta- command to convert some shapefiles to stata format, grabbing Lat/Lon data and merging into another dataset. There were several compressed shapefiles I wanted to download contained in a directory from the web. I could manually download each file and uncompress each one but that would be time consuming. Also, [...]