The Fun World of User Written Stata Commands

Prashansa Srivastava
5 min readNov 2, 2020

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!

dadjoke

Created by Shambhavi Priyam this one provides lame and terrible amazing jokes while coding.

nicewords

Created by Joe Long to pay compliments. It can also generate insults, put the compliments in a smiley and put the insults in a negative smiley. From personal experience, the compliments are perfect to put at the end of a master .do file after running a lengthy code.

reggae_music

A personal favourite created by Matteo Ruzzante, it generates YouTube/Spotify links and playlists to reggae music. Perfect to discover new music while working!

motivate

Created by Kabira Namit generates a humorous or inspiring quote, great for low days and a laugh.

demotivate

The antithesis to motivate created by Kevin Denny provides some demotivational quotes to remind users of the reality to your research.

motivatedolly

Created by Bailey Palmer, motivatedolly pulls from Dolly’s enormous discography spanning over half a decade, plus her famous one-liners, to help us make it through tough times. Song lyrics include a link to YouTube where you can listen to the song for some musical inspiration. The advanced option includes links to Bedtime with Dolly, a quarantine-era video series of Dolly reading inspirational selections from her Imagination Library. As a lifelong fan of Dolly Parton this one is a true favourite.

heart

Created by me this command generates pick up lines, adorable graphs or a simple row of hearts. Great to fill in your Stata breaks, let hearts scatter on your screen, show your admiration for your collaborators by sneaking it in code for others to run or let Stata dazzle you with its wit and try to win you over with its pick up lines to once and for all settle the Stata vs R debate. My particularly favourite part is typing ‘help heart’ and feeling specially dramatic.

care

Created by me during Mental Health Awareness Week, this little helper randomly generates reminders to check-in with themselves, a fun fact or an idea to unwind to keep users on top of their mental well-being.

ghazal_guzzler

Another one by me, inspired by Matteo’s reggae_music command, generates melancholic ghazal tunes. Because everyone needs Farida Khanum in their lives.

haiku

Created by me to cater to my literary side, this one generates random haikus. The overview of the command in the help file contains a haiku as well!

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

--

--

Prashansa Srivastava

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