A very pro #StataTip:
You can split & stack your dofiles in tabbed windows. Just drag a dofile to the left of the dofile editor and click "New vertical tab group"
This is highly useful for parallel updating or comparing multiple files, and makes the workflow easier.
A pro #StataTip for #reshape that I just rediscovered while fixing some code on the train:
One can use the @ in reshape commands to indicate where the j-index is. This is especially useful if:
(a) variable names r not consistent (fig 👇)
(b) variable names have mutiple numbers
RT @AsjadNaqvi@twitter.com
A #StataTip: If you are repeatedly using the same set of commands, for example for graphs or regressions, then:
1) start using macros, and/or
2) define small programs
This saves you:
(a) space, and
(b) the hassle of copy/pasting
and looks neater!
A #StataTip: If you are repeatedly using the same set of commands, for example for graphs or regressions, then:
1) start using macros, and/or
2) define small programs
This saves you:
(a) space, and
(b) the hassle of copy/pasting
and looks neater!
A #Statatip that I rediscovered while updating this article: you can change whether your graphs are tabbed or not. Graphs popping up in separate windows makes life so much easier when comparing stuff:
All you need to do is "set autotabgraphs off"
---
RT @asjadnaqvi
A #Statatip: If you r making multiple graphs & want to keep them on the screen, name them. This will ensure that they all stay open. Without names, the newer replaces the o…
https://twitter.com/AsjadNaqvi/status/1449038966272008193
RT @StataTexBlog@twitter.com
#StataTip: use --set varabbrev off-- to only allow full variable names in your @Stata@twitter.com code (and no abbreviations)
RT @StataTexBlog@twitter.com
#StataTip: use --set varabbrev off-- to only allow full variable names in your @Stata@twitter.com code (and no abbreviations)
#StataTip: use --which name_ado_file-- to show from which folder @Stata@twitter.com calls the .ado-file
RT @StataTexBlog@twitter.com
#StataTip: use --set varabbrev off-- to only allow full variable names in your @Stata@twitter.com code (and no abbreviations)
Once in a while I post a #StataTip. Below is a thread that collects them all:
---
RT @asjadnaqvi
A 🧵 to consolidate the #Statatip posts from the past three years! Bookmark these.
If you want to read them in detail, have a look at the Awesome @Stata tips collection:
https://medium.com/the-stata-guide/the-awesome-stata-tips-collection-6805afdedffa
Its updated every 2-3 months or so. Many tips below 👇
https://twitter.com/AsjadNaqvi/status/1570150362505687041
#StataTip: use --set varabbrev off-- to only allow full variable names in your @Stata@twitter.com code (and no abbreviations)
#StataTip: to format output in your log file or results window in @Stata@twitter.com, you can print text in red (--di as error "Text in red"--) or bold (--di as result "Text"--). If you are using black background use "as text" (green), "result" (yellow), "error" (red), and "input" (white)
#StataTip: for blockwise selection of code in @Stata@twitter.com|'s do-file editor, press the option key (Mac) or alt key (Windows) and mark the respective cells with your mouse/cursor.
RT @JanKabatek@twitter.com
Here's a handy #Statatip:
If you want to create a set of dummies corresponding to the unique values of another variable, you can use the tabulate command 👇
. sysuse auto, clear
. tab mpg, gen(d_)
. d d_1-d_21
#StataTip: to suspend the execution of a @Stata@twitter.com loop (eg when certain conditions are met), add --continue-- and Stata will move to the next iteration (to stop the loop entirely, write --continue, break--)
RT @AsjadNaqvi@twitter.com
Extremely few know about this #Statatip: In v17, there is a built-in command to build var lists quickly. Try this out:
sysuse auto, replace
vl set
It will auto generate lists of categorical and continuous variables. Want more info? try "vl list".
check it out: "help vl"
Incredibly smart use of char(10) to break lines in figure markers
RT @AsjadNaqvi@twitter.com
Here is a #Statatip. Let's learn how to split marker labels across lines, a task previously considered impossible 🤯
First lets draw a layer:
sysuse auto, clear
set seed 400
gen sample = runiform() < 0.2
scatter price weight if sample, mlab(make)
Labels are in the same line.
#StataTip: if you want to use quotation marks in a local, embed the local in compound quotation marks:
local compound=`"Bernie said "Hi" "'