Skip to main content


Showing posts from December, 2010

Finding your way around Stata

One of the things my students first get stuck on is how to find things  (e.g. files, directories, variables with particular labels or notes) in Stata. There are a lot of commands to find things like files/datasets, directories, command help documentation, user commands/ado-files, variables, values, notes/chars , etc -- there are some commands that find only one of these things, some commands can find several of these things, and most of these things can be found by more than one command.  It can be a bit overwhelming and confusing and I've found that students who fall behind early in a class using Stata often get stuck at the point of being able to find these things -- particularly directories and command ado/help files. Of course good use of a search engine is a key resource, but the table below gives an overview of the commands I use to find these things in Stata (this table can also found in my Module 1 Lecture for PHPM 672).    Undoubtedly, there are other commands that wi

Fun with Stata: Games for Stata Edition

Over at Mitch's "Stata Daily" blog, he describes a "hangman" game sent to him by Marek Hlavac .  I'm a sucker for non-standard uses of Stata (e.g., [ 1 ] [ 2 ] [ 3 ]), so I played with it for a while.  This also convinced me to make public one of my earliest attempts at writing a Stata ado-file/program:  - blackjack -. The game is played by typing -blackjack- into the command window and then the game prompts the user for the amount she wants to bet (default is $500 which replenishes after you lose it all or you exit Stata), and whether to hit or stay.  It doesn't accurately represent all the rules and scenarios of a real game a blackjack (e.g., no doubling down), so don't use it to prep for your run at taking down a Vegas casino. Fair warning that -blackjack- is visually quite ugly (the cards tend to misalign; I could have come up with a better card design for face cards than a "{ Stata }" center; and (because I was learning about Stat

Statistics Software Showdown: Google Ngram

Using Google's Ngram Viewer , here's the breakdown of Stata vs. SAS vs. SPSS.   Stata didn't do as well as I hoped, but in taking a closer look there are at least a couple of reasons to be optimistic about Stata's prospects. (1)  SAS is benefitting from lot's of books written about the British Special Air Service (SAS).   (2) As of yet, there doesn't appear to be a way to refine these searches with boolean search parameters.  If so, we could have searched for "SAS -British" or "SPSS | PASW", etc. (3) I couldn't find a way to search for the software 'R' using Ngram. (4)  Stata seems to have as much, if not more, web presence / resources as the other software packages.   Using a regular google search: "Stata" + statistical software  22.3 million pages "SPSS" + statistical software  28.2 million pages "SAS" + statistical software  17.6 million pages "PASW" + statistical software  53K pa

Fun with Stata: Running Stata from your iPhone

There are literally tens of people out there in the world that have at some point or another thought "I really wish I could run something in Stata right now on my iPhone." Well, I recently killed some time making that a possibility. In order to get results from Stata on your iPhone anywhere/anytime, this process requires 5 components: (1) Stata (10 or later) installed on a Mac OSX (10.5 or later) that is always connected to the internet (2) A Dropbox account linked to your Mac that has Stata installed (3) iStata.scpt Applescript file to manage files put in Dropbox (4) iStata.ado to run the file, log the output, and put it back in Dropbox (5) the free application Plaintext for iPhone (or some equivalent) to write and view .do files written and run from your iPhone Setup: You'll need to save the iStata.scpt and files into the folders referenced in these scripts in your Dropbox folders on your Mac OSX. Really, you can place these files/folders an