The Fun World of User Written Stata Commands

If you’re a Stata user you must have at one point or the other made use of a community-contributed Stata command. The wonderful community of Stata users lets users easily write commands that can be made available to all users through the SSC archive or the Stata journal.

The most common examples about the beauty of these commands discuss how easy they make a treatment-effects estimation, manipulating complicated data, making elegant graphs, econometric modelling, working with spatial data and other complex tasks. However, one often ignored type of user-written commands are the ones that make coding on Stata fun! I’m talking about commands that may not necessarily do something “useful” but are made for unique purposes that bring joy. Such as a command that sends appreciation in the form of a smiley face or one that randomly generates reggae music links to listen to.

As someone who has written 3 of these irrelevant and joyful commands the process of writing these is akin to creating art. Like any creative project it starts with an idea you think is brilliant and fun, you put in time and effort, fix tons of unanticipated problems along the way, adapt your original idea and voila it’s done. Moreover, this creative pursuit also comes with the joy of sharing your art with people who are passionate about it. The writing of your own command and sharing it with the world is in itself a collaborative project. In the process of sharing the obscure thing you care about, you find other people care about it and find meaning in it as well! These are great passion projects for creative coders and as Austin Kleon best put it:

“The act of sharing is one of generosity — you’re putting something out there because you think it might be helpful or entertaining to someone on the other side of the screen.”

Sure, these aren’t really needed. But the world is better off because of them. Learning any coding language should be fun and exciting, and not intimidating and inaccessible- which it can often turn out to be. These creative commands make learning a less alienating process for those new to coding. Seeing that a coding language can be funny and silly can inspire learning. For seasoned users, they’re great stress busters to keep your sanity at check and anger at bay while toiling at the coalface of data cleaning. I personally like these packages because they reaffirm why I loved learning programming in the first place. The most exciting way I learnt how to code was by creating fun small scale projects that helped me apply my new skills. Even though I enjoy writing code in my job nowadays, it’s nice to get back in touch with that feeling once in a while.

Here are some commands that have bought joy to me!











Do you know any other commands that have sparked joy? Share them!

Self proclaimed bluestocking, famed anti-socialite and occasional goat chaser. Currently an RA at JPAL-SA, aspiring kind human. All views are my own.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store