posts tagged “tips-n-tricks”

I was born in Northern Colorado and now live just outside the District of Columbia. I can attest from personal experience that these two places do not share much. Except, that is, for their desire to become states.1

I was curious what would happen if both became states as a modern-day [Missouri Compromise]. I wrote the following script to make the Amazing Apportionment Machine to reapportion seats and looked at two scenarios: the current distribution of congressional districts and the distribution if "Northern Colorado" and the "State of Columbia" were added as states.

The code has some useful tricks for general purpose in it. First, it defines a program ...

While writing scripts is one of the most important skills for reproducible quantitative sociology, the typical convention is to pick up the skills through more experienced colleagues in graduate school or at the workplace. Below are a few tips that I have learned from others, picked up on my own, or otherwise accumulated in my arsenal of tricks that I thought that I would pass along. There are great resources out there, but I thought it would be helpful to pass along what I think are the most important and helpful tips.

  1. Include a brief header in all scripts indicating the name of the file, the creator, and a brief ...

Programming in Stata is relatively straightforward and this is partly because the programming syntax is both powerful and relatively straightforward. There are, however, a few minor annoyances in Stata's language including using the backtick and apostrophe to indicate local macros (i.e.,`localname'). Among these shortcomings, I would argue that the lack of anything like a list in Stata's language is one of the largest.

In most langauges, you can store a list of items and refer to the item in the list by some sort of index. This is particularly helpful for iterating over the same step multiple times. Lists generally come in two flavors: lists to ...