Home > Company > Our users’ favorite commands

Our users’ favorite commands

We recently had a contest on our Facebook page. To enter, contestants posted their favorite Stata command, feature, or just a post telling us why they love Stata. Contestants then asked their friends, colleagues, and fellow Stata users to vote for their entry by ‘Like’-ing the post. The prize, a copy of Stata/MP 12 (8-core).

The response was overwhelming! We enjoyed reading all the reasons why users love Stata so much, we wanted to share them with you.

The contest question was:

Do you have a favorite command or feature in Stata? What about a memorable experience when using the software? Post your favorite command, feature, or experience in the comments section of this post. Then, get your friends to “like” your comment. The person with the most “likes” by March 13, 2012, wins. The winner will receive a single-user copy of Stata/MP8 12 with PDF documentation.

We had many submissions with multiple “likes”. The winning submissions are:

1st place:
Rodrigo Briceno
One of the most remarkable experiences with Stata was when I learned to use loops. Making repetitive procedures in so short amounts of time is really amazing! I LIKE STATA!
2nd place:
Juan Jose Salcedo
My Favorite STATA command is by far COLLAPSE! Getting descriptive statistics couldn’t be any easier!
3rd place:
Tymon Sloczynski
My favourite command is ‘oaxaca’, a user-written command (by Ben Jann from Zurich) which can be used to carry out the so-called Oaxaca-Blinder decomposition. I often use it in my research and it saves a lot of time – which easily makes it favourite!

Complete entry list

Mburu James inlist()
February 21 at 11:28am 路 Like 路 2.

Robin Kim exit
February 21 at 11:28am 路 Like 路 5.

Maximiliano Exequiel display !! haha.. it’s neccesary when you don’t have a calculator close or you don’t want to open the Windows’ calculator 馃檪
February 21 at 11:31am 路 Like 路 3.

Felipe Rojas help
February 21 at 11:31am 路 Like 路 2.

Reynaldo Rojo Mendoza usespss. So long, Stat/Transfer!
February 21 at 11:32am 路 Like 路 5.

Robert Birkelbach I loved the set memory command. I miss it in Stata 12.
February 21 at 11:33am 路 Like 路 32.

Matt Incantalupo margins
February 21 at 11:33am 路 Like 路 2.

Rodrigo Aranda di in green”隆隆VIV” in white”A ST” in red”ATA!!”
February 21 at 11:35am 路 Like 路 9.

Emily Ryder 3 words: SET MORE OFF. simplistic, i know, but let’s not pretend it isn’t extremely useful when running tabulations with tons and tons of data!
February 21 at 11:39am 路 Like 路 3.

Mike Gruszczynski foreach var of varlist x y z {
do something
February 21 at 11:39am 路 Like 路 4.

Peter Tennant Edit > Preferences > General preferences > Result colors > Color Scheme: Classic 馃檪
February 21 at 11:43am 路 Like 路 6.

Francisco Javier Arceo First order stochastic dominance? How do you find out!? kdensity y, addplot( kdensity x)
February 21 at 11:48am 路 Like 路 12.

Julian Sagebiel my favorite command is ” rename ” because it is very simple, effective, efficient , no waiting time and you can immediately observe the outcome of what you did. especially in combination with preserve and restore one can have a lot of fun with it
February 21 at 11:48am 路 Like 路 3.

Tihana Skrinjaric my favourite command is arch, because i study and estimate arch and garch models! 馃檪
February 21 at 11:48am 路 Like 路 36.

Jens Rommel global
February 21 at 11:52am 路 Like 路 4.

Sarah Bana Favorite Stata Function: save
February 21 at 11:56am 路 Like 路 2.

Sezer Alcan my favorite command is “log” because it enables me to log everthing I type in a file
February 21 at 11:59am 路 Like 路 42.

Carrie Daymont renpfix, to change the first parts of all variable names that start with the same stub. One of those things you want to do but don’t think there will be a command for…but there is!!!
February 21 at 12:02pm 路 Like 路 2.

Brayan Rojas My favorite command is cond()…
February 21 at 12:10pm 路 Like 路 3.

Rafael Gralla my favorite command is help 馃槈
February 21 at 12:13pm 路 Like 路 2.

Bryce Mason Whomever made the “reshape” command ought to be given a medal. That command has saved me and my clients a boatload of time and money.
February 21 at 12:15pm 路 Like 路 70.

Rodrigo Brice帽o One of the most remarkable experiences with Stata was when I learned to use loops. Making repetitive procedures in so short amounts of time is really amazing! I LIKE STATA!
February 21 at 12:16pm 路 Like 路 2223.

Gabi Huiber My favorite feature is not a command, but an option: rclass. I usually define a program, setLocals, at the top of the master do-file. Here I define as local macros everything that I need to use in more than one place: file paths, variable lists, name lists, constants, whatever. I call this program everywhere I need any of these things. After any given call, I only reconstitute the particular r() results that I need in that place. And if I expand the functionality of my do-file and I need to add another thing that will be used in more than one place, I know I only need to add it in the definition of setLocals as a macro to be returned later. That is why rclass is my friend.
February 21 at 12:26pm 路 Like 路 1.

Won-ho Park All the single-stroke commands: d(escribe), e(xit), h(elp), m(ata), n(ote), and q(uery).
February 21 at 12:42pm 路 Like.

Francisco Javier Arceo “Xi:” is also pretty awesome when you have an enormous set of dummies.
February 21 at 12:55pm 路 Like 路 2.

Ryan Johnson _n and _N. Before Stata, I was lost, but now I am found. Database-table transformation is now child’s play where it once was seemingly impossible.
February 21 at 12:56pm 路 Like 路 5.

Tymon Sloczynski My favourite command is ‘oaxaca’, a user-written command (by Ben Jann from Zurich) which can be used to carry out the so-called Oaxaca-Blinder decomposition. I often use it in my research and it saves a lot of time – which easily makes it favourite!
February 21 at 12:59pm 路 Like 路 140.

Luca Campanelli I’m a multilevel mixed-effects person and, for exploratory purpose, it’s often important to examining the OLS regressions for each Level 2 unit… well, just run dozens of regressions, copy the coefficients of each regression, paste them in an excel file and you’re done. Then, one day, the light, the command -statsby-. My life changed…
February 21 at 2:06pm 路 Like 路 8.

Robert Duval H Margins is by far my favorite… A true time saver!
February 21 at 2:13pm 路 Like 路 12.

Pankaj Gaur tab is my favorite command
February 21 at 2:21pm 路 Like.

Cristian Gil-S谩nchez the best command ever to learn stata is: db
February 21 at 2:31pm 路 Like 路 6.

Dmitriy Poznyak Esttab and estout save ridiculous amount of my research
February 21 at 2:31pm 路 Like.

Sang-Min Park my funniest experience was how the help file for factor variables explained interactions: “group#sex … same i.group#i.sex”!
February 21 at 2:35pm 路 Like 路 4.

Frank MacCrory My favorite command in Stat is ‘program’, in fact Stata’s programming capability is why I prefer it over other statistics packages. Need to extend what a Stata command does? The source code for most of them is right there for you to use as a starting point.
February 21 at 2:55pm 路 Like 路 3.

Juan Jose Salcedo ?…..
My Favorite STATA command is by far COLLAPSE! Getting descriptive statistics couldn’t be any easier!
February 21 at 3:06pm 路 Like 路 1462.

Dimitriy V. Masterov Wondeing when Stata will finally add the “gen dissertation, robust” command.
February 21 at 3:25pm 路 Like 路 21.

Norbert Schulz constraint
February 21 at 4:38pm 路 Like 路 1.

Luca Bossi My favorite command is “exit”.February 21 at 6:10pm 路 Like.

Stephen Merino Stata’s “reshape” command turned my egocentric network data into sweet, sublime, dyadic data that allowed me to analyze relationship characteristics associated with social support provision. And a shout-out to Rebekah Young for all of her help!! I love you, Stata.
February 21 at 7:43pm 路 Like 路 1.

Trey Marchbanks love forval x = 1/99
February 21 at 8:55pm 路 Like.

Jose Martinez Outreg2. Having tables and tables to format, doesn’t get better than this.
February 22 at 9:43am 路 Like 路 1.

Habtamu Tilahun Kassahun I love the Change directory (CD) command!!!
February 22 at 12:12pm 路 Like 路 1.

Austin Nichols Favorite command? mata
February 22 at 3:31pm 路 Like 路 2.

Daniel Marcelino My favorite command is ‘egen’, its is one of the most powerful though simply command of Stata. February 22 at 5:05pm 路 Like 路 3.

Stas Kolenikov -capture-, -assert- and -confirm-, in various combinations. You never know what kind of crappy data your friends, colleagues and independent end users of your programs will supply.
February 22 at 6:20pm 路 Like 路 3.

Billy Bass Aside from seconding what Stas already said, I’m a big fan of the new SEM capabilities and the Stata User-Community as a whole. Unlike some other software platforms, StataCorp and the user-community are probably the greatest asset to the program.
February 22 at 6:30pm 路 Like 路 6.

Billy Schwartz foreach var of varlist * {} rhymes nicely.
February 22 at 7:57pm 路 Like.

Chamara Anuranga My favourite command is levelsof. It will store content of the variable in r(varlist). It make life easier for loop command. example:
sysuse auto.dta,clear
levelsof rep78,local(list)
foreach item in `list’ {
dis “`item'”
sum price if rep78==`item’
I have used this command to draw graphs for WDI data for each country.
February 23 at 12:16am 路 Like 路 27.

Till Da Tilt Ittermann fracpoly
February 23 at 7:33am 路 Like 路 1.

Adrian Alejandro Perez Grandes mi comando favorito es el arco, porque yo estudio y el arco y la estimaci贸n de modelos GARCH
February 23 at 1:56pm 路 Like 路 1.

Oliver Jones Have you ever received a new data set with no documentation or even worse BAD documentation? Just use codebook and the sun is shining again! 馃檪
February 24 at 4:40am 路 Like 路 14.

Marilyn Santana Reyes my favorite command is help 馃槈
February 24 at 8:14am 路 Like 路 3.

Leonardo Sanchez My favorite command is Exit. It means I am ready to go home
February 24 at 9:34am 路 Like 路 2.

Maria Gabriela Garcia Andrade ….. My Favorite STATA command is by far COLLAPSE! Getting descriptive statistics couldn’t be any easier! …..
February 24 at 10:07pm 路 Like 路 2.

Anayatullah Niyazi my favarate command in stata package is for generating new variable “gen new variable name total(old variable) by time” and for panel data regression “xtreg dependent variable independent variable , fe or re”.
February 25 at 11:39am 路 Like.

Victor Fernandez my favorites commands in stata are var and predict. I love getting to know the relationships between the variables and then predict how they gonna behave in the future. Thanks for letting me win the copy of stata!
February 25 at 8:38pm 路 Like 路 4.

Vane Ramirez Lopez Exc
February 26 at 1:12am 路 Like 路 1.

Zaira Araujo Jones exce =)
February 26 at 5:47am 路 Like 路 2.

Cecil Moitland Rodriguez the merge command is fantastic!
February 26 at 7:22pm 路 Like 路 4.

Jose Francisco Pacheco-Jimenez You just need one command: HELP! And that makes STATA the best of all.
February 26 at 7:23pm 路 Like 路 4.

Reymond Ssr regress rocks
February 26 at 7:25pm 路 Like 路 1.

David Mora G is one of the best commands please vote for me..
February 26 at 7:26pm 路 Like 路 1.

Alejandra Hern谩ndez tab is the best command of Stata…
February 26 at 7:30pm 路 Like 路 1.

David Lang my favorite command is net search, as it allows me access to all the new procedures.
February 27 at 1:26pm 路 Like 路 4.

Jason Gainous My favorite command is whichever one I have to look up next on the Google.
February 27 at 11:10pm 路 Like 路 44.

V铆ctor Hugo P茅rez My favorite command? Uhhh, that’s a hard one… I’ll guess it is foreach… It’s the more flexible and time-saving command I have ever used. It’s easy to use and lets you avoid lots of boring programming. February 28 at 2:38pm 路 Like 路 27.

David Elliott When you have to do some repetitive heavy lifting there is nothing better than:
levelsof x, local(xlevels) foreach level of local xlevels { …`level’…
February 28 at 2:42pm 路 Like 路 3.

Niki Yang My favorite command is “DIsplay 1+1” which is a great substitute for a pocket calculator! For everything else, I use Mata!
February 28 at 2:53pm 路 Like 路 4.

Tobin Hanspal estout!
February 28 at 2:55pm 路 Like 路 1.

Adrian Mander Exit,clear. It means it is home time
February 28 at 4:34pm 路 Like 路 3.

Tomek Godlewski Control alt delete.
February 28 at 6:40pm 路 Like 路 2.

Alberto Dorantes My favorite command: for data management: collapse (much more efficient than PivotTables of Excel), and for data analysis the pre-command: rolling, which saves tons of programming lines
February 28 at 6:48pm 路 Like 路 3.

Denier Duarte Alvarado Exit clear..
February 28 at 9:51pm 路 Like 路 1.

Hiroshi Kameyama now using many times, “arfima”, what happen next?
February 29 at 1:48am 路 Like.

Antoinette Autopsy My Favorite STATA command is collapse.
February 29 at 10:47am 路 Like 路 91.

Korin Esquivel listo !
February 29 at 2:34pm 路 Like 路 2.

Cirito Moran Contreras dame tu pin x interno
February 29 at 3:25pm 路 Like 路 1.

Stata user foreach and forvalus are both great conmands,i love them
February 29 at 4:59pm 路 Like 路 1.

March 1 at 4:04pm 路 Like 路 1.

Aguirrense Rafiko De Corazon Zambrano ps xq tanto ingles
March 1 at 7:07pm 路 Like 路 2.

Ines Bouassida My favorite command is “merge”
March 5 at 12:43pm 路 Like 路 38.

Chase Coleman I think my favo makes creating binary variables quick and simple
March 5 at 11:37pm 路 Like 路 18.

Juliana Camacho S谩nchez my favorite command is help
March 6 at 12:38pm 路 Like 路 5.

Vicki Stagg My favorite Stata data manipulation tool combines the use of _n and subscripting.The following do-file can be applied to patient data over various numbers of visits. Input data would include patient ids, visit dates and systolic BP measurements, for example. A patient sequence number and baseline (from the first visit) systolic BP value are generated and applied to each record. sort patientid visitdt
bysort patientid: gen seq_visit=_n
bysort patientid: gen tot_visit=_N
*tabulate the number of visits
tab tot_visit if seq_visit==tot_visit
*prepare to generate patient sequence number and baseline sys bp
sort seq_visit patientid
gen patientn=_n if seq_visit==1
gen base_bpsys = bp_sys if seq_visit==1
sort patientid seq_visit
bysort patientid: replace patientn=patientn[1]
bysort patientid: replace base_bpsys= base_bpsys[1]
March 9 at 4:29am 路 Like 路 7.

Christopher Salazar me gusta propio viejo
Saturday at 2:16pm 路 Like.

Liu Pluas Diaz propio pepa
Saturday at 3:50pm 路 Like.

Mariel Garc铆a M I see two people who brought over a thousand likes each to this status update. I hope the company will appreciate that and give them both a free copy. Statisticians don’t get that much support everyday!
Sunday at 11:45pm 路 Like 路 1.

Alexander A. St盲ubert I got this reply after running the GLLAMM command: “can’t get correct log-likelihood: -39386.119 should be -39386.664. something went wrong in comprob3”. Usually Stata is very precise when stating an error… usually.
Yesterday at 11:59am 路 Like.

Rajesh Tharyan my favourite command is ! which allows you to send commands to your operating system or to enter your operating system for interactive use, !!..:)
Yesterday at 12:01pm 路 Like 路 1.

Nguyen Ngoc Quang My favorite command is subinstr to convert the unicode font
Yesterday at 12:04pm 路 Like 路 1.

Juan Pablo Ocampo Years ago while doing an econometrics homework I had a lot of trouble with a dummy trap. Suddenly a friend suggested to use “tetrachoric” to check correlation between dummies. I’m in love with that command since, also it’s fun to say it…tetrachoric
23 hours ago 路 Like 路 1.

G眉ls眉n Akin It would be great if these comments could be saved somewhere.. I have learned several things to make life easier by browsing some, and would like to read all at some point.
23 hours ago 路 Unlike 路 1.

Andrew Dyck My favourite command is -reshape-. This is an enormous pain in most statistical frameworks, but sooo easy with STATA. Keep up the great work!
20 hours ago 路 Like 路 3.

Ronald Moreano Que El Se帽or Dios Jehova te bendiga, guie tu camino e ilumine tu vida por siempre.
14 hours ago 路 Like 路 1.

Minh Nguyen My favourite command is egen with bysort.
12 hours ago 路 Like.

  • Ca Acosta966

    My favorite thing about Stata is that i was able to make a montecarlo simulation and nobody thought i could do that! Stata has a lot of power people dont know

  • My favorite Stata command is “merge… using”. This is so useful in merging two datasets based on some criteria. I tried to do the same in Excel, but could not. After many days of searching on the Internet, I was surprised to see that it can be accomplished in Stata, my most favorite statistical software.

  • melexedec

    fixed effects estimation

  • Vkborooah

    my favourite command is margins (formerly mfx). Great for calculating marginal probabilities from ordered/multinomial probit/logit equations.聽