Asjad Naqvi :stata: · @asjadnaqvi
433 followers · 306 posts · Server econtwitter.net

A very pro :

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.

#StataTip

Last updated 2 years ago

Asjad Naqvi :stata: · @asjadnaqvi
417 followers · 215 posts · Server econtwitter.net

A pro for 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

#StataTip #reshape

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
609 followers · 649 posts · Server econtwitter.net

RT @AsjadNaqvi@twitter.com

A : 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!

#StataTip

Last updated 3 years ago

Asjad Naqvi :stata: · @asjadnaqvi
410 followers · 168 posts · Server econtwitter.net

A : 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!

#StataTip

Last updated 3 years ago

Asjad Naqvi :stata: · @asjadnaqvi
410 followers · 164 posts · Server econtwitter.net

A 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 : 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…
twitter.com/AsjadNaqvi/status/

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
598 followers · 535 posts · Server econtwitter.net

RT @StataTexBlog@twitter.com

: use --set varabbrev off-- to only allow full variable names in your @Stata@twitter.com code (and no abbreviations)

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
590 followers · 489 posts · Server econtwitter.net

RT @StataTexBlog@twitter.com

: use --set varabbrev off-- to only allow full variable names in your @Stata@twitter.com code (and no abbreviations)

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
582 followers · 461 posts · Server econtwitter.net

: use --which name_ado_file-- to show from which folder @Stata@twitter.com calls the .ado-file

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
578 followers · 435 posts · Server econtwitter.net

RT @StataTexBlog@twitter.com

: use --set varabbrev off-- to only allow full variable names in your @Stata@twitter.com code (and no abbreviations)

#StataTip

Last updated 3 years ago

Asjad Naqvi :stata: · @asjadnaqvi
376 followers · 89 posts · Server econtwitter.net

Once in a while I post a . Below is a thread that collects them all:

---
RT @asjadnaqvi
A 🧵 to consolidate the 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:

medium.com/the-stata-guide/the

Its updated every 2-3 months or so. Many tips below 👇
twitter.com/AsjadNaqvi/status/

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
571 followers · 416 posts · Server econtwitter.net

: use --set varabbrev off-- to only allow full variable names in your @Stata@twitter.com code (and no abbreviations)

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
482 followers · 340 posts · Server econtwitter.net

: 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

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
465 followers · 311 posts · Server econtwitter.net

: 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.

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
465 followers · 311 posts · Server econtwitter.net

RT @JanKabatek@twitter.com

Here's a handy :
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

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
400 followers · 221 posts · Server econtwitter.net

: 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--)

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
347 followers · 209 posts · Server econtwitter.net

RT @AsjadNaqvi@twitter.com

Extremely few know about this : 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"

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
332 followers · 185 posts · Server econtwitter.net

Incredibly smart use of char(10) to break lines in figure markers

RT @AsjadNaqvi@twitter.com

Here is a . 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

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
325 followers · 168 posts · Server econtwitter.net

: if you want to use quotation marks in a local, embed the local in compound quotation marks:
local compound=`"Bernie said "Hi" "'

#StataTip

Last updated 3 years ago

StataTeX Blog :verified: · @statatexblog
325 followers · 168 posts · Server econtwitter.net

: variable lists selected by "*" select all variables. To select all but a few (e.g. "year") write --ds year, not-- and get all variables but the one specified (results stored in local `r(varlist)') – thank you !

#StataTip #NickCox

Last updated 3 years ago