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.
Blog
All entries categorized “tips-n-tricks”
Basic Tips for Writing Statistical Scripts
Sunday, July 17th, 2011 6:14p.m.
Nesting Stata Macros, or Hacking a Hash Map
Monday, June 6th, 2011 6:37p.m.
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 which you can refer to an item by its position in the list or lists which you can refer to by a keyword (called hash maps in computer science lingo). Stata's matrices can be used for the first, though doing so might become complicated if you want to do something besides storing basic numbers or strings.
Front Page
About
- Information about the purpose and topics of this blog can be found here.
Feeds
Archive
- Oct 2011
- Aug 2011
- Jul 2011
- Jun 2011
- Apr 2011
- Mar 2011
- Feb 2011
- Oct 2010
- Sep 2010
- Jul 2010
- Jun 2010
- May 2010
- Apr 2010
- Feb 2010
Categories
Tags
- advice
- architecture
- blogs
- built-environment
- cities
- data
- data-management
- data-visualization
- David-Kindig
- demography
- disorder
- gabriel-rossman
- gentrification
- grants
- graphics
- grocery
- health-policy
- immigration
- inequality
- Jon-Stewart
- kriging
- macros
- measurement
- National-Grocers-Association
- neighborhood-effects
- neighborhoods
- nutrition
- obesity
- orgtheory
- PAA
- peer-review
- personal
- population-health
- public-health
- rejection
- research-design
- research-process
- residential-mobility
- segregation
- Stata
- statistics
- strings
- suburbs
- teaching
- The-American-Prospect
- This-American-Life
- tips-n-tricks
- urban-policy
- whole-foods
- WNYC
- workflow
Miscellany
- The views presented here are solely and entirely my own, they do not represent those of my colleagues, employer, or any funding agencies which may support me.
- The writing on this blog is covered by a Creative Commons License (described here). Feel free to distribute or re-post with a link to the original content provided that it is freely available to others.
