Stata ressources for beginners
You’ve got Stata installed and are ready to analyze your data. But how do you get started with importing your data, removing outliers errors and make that sweet graph? In this post, I’ll share my favourite go-to sources on.
Learning to use Stata can get pretty frustrating. Luckily, there are really good guides to find on the internet. Taking the time to read a few or watch some tutorial videos can be a good investment in time. That is unless you really enjoy aimlessly searching around the internet to understand why “it just won’t work”.
In this post, I’ll share my favourite go-to ressources for whenever Stata sends you a curve ball.
Table of Contents
There are a lot of YouTube tutorials on Stata and it is a good place to start when learning Stata. Personally, I prefer StataCorp’s own YouTube channel with Chuck Huber, because 1) they have tons of tutorials covering both both simple and complicated tasks, 2) videos are conveniently categorized in playlists, and 3) most importantly, because Chuck’s videos are short! There are a lot of other videos on YouTube that have better graphics or cover more complex stuff. But they can be hit’n miss and some of them spend ages explaining every excruciating detail of even the simplest functions. Not Chuck Huber, that guy is a surgeon.
Some good playlists to start with:
Back-to-School link) - Quick introduction to the most common tasks. Importing data, box-plots, t-tests, the works.
Data Management) - How to work with dates, convert text to numbers, reshaping data from wide to long format etc. Data management is by far the most time-consuming thing to learn in Stata, so I suggest you invest some time here.
If you want to go oldschool and read a book (or e-book), I’d recommend:
- Take Good Care of Your Data, by Svend Juul ( link)
A short (and free!) little pamphlet. It gives quick overview on how to organize your data and work in Stata. Would especially recommend the sections on do-files.
- An Introduction to Stata for Health Researchers, by Svend Juul ( link) The second book is THE in-depth Stata bible for the truly dedicated. There is a reason why Svend Juul is considered something of a Stata legend and this book is a big part of it. It covers everything from importing data to advanced programming and analyses. Costs around 60$.
Stata cheat sheets
The cheat sheets likely provide the best overview of (almost) all commands you are ever going to need. Commands are neetly sorted after the different steps most analyses consists of:
Data processing: Importing data, exploring data for weird outliers, removing duplicates, making new variables etc. There are commands for importing from Excel, text files etc.
Data transformation: Removing variables, labeling data, correcting errors, summarizing variables and generating new ones. And of course how to merge (combine) two datasets. Oh merging…
Data visualization & Plotting in Stata: Scatter plots (ie. XY-plots), histograms, bar charts, boxplots, how to combine graphs, and the list goes on.
Data analysis: T-tests, linear regressions, non-parametric tests, time to event analyses, and much much more. This is what it all comes down to in your hunt for that ever-elusive p-value <.05.
Programming: This section is for when you get a bit more advanced and want to learn about the endless possibilities in “loops”, “globals”, locals” and “tempfiles”. Stata programming can save you from writing the same code over and over or from manually copy/pasting hundreds of csv files into a a single data file. Be warned: this rabbit hole is deep and can get time-consuming.
Stata’s dialog box and help function
When I have problems with a specific Stata function, the first thing I usually do is typing
db [insert function name]
Db means dialog box and it basically opens a dialog box for the specific command so you can select the variables and options with the mouse instead of typing it as a command.
db doesn’t solve your problem, then you can type
help [insert function name]
This will open the Stata help file that explains how to use the command and provides some examples. If that still doesn’t do it, then it is time to ask Google or a friend.
Statalist - the Stata forum
Whenever I google “stata how to something-something”, Statalist is usually the first hit I get. The layout is pretty old-fashioned but this is truly a goldmine of Stata poesi.
A word of warning before you ask a question at Statalist: Read their guide first! Stata-aficionados from around the globe are willing to help you but they will bite, if you don’t follow protocol. It is called Stata, not STATA. Use your real name. And woe you, if you ask a question without submitting your code.
Read. The. Guide. First.
I hope some of these ressources are useful to you. Feel free to reach out if you have questions, comments, or suggestions for other good Stata ressources for beginners.