Skip to content

Instantly share code, notes, and snippets.

@bbdaniels
Last active January 17, 2019 22:55
Show Gist options
  • Save bbdaniels/a3c9f9416f1d16d6f3c6e8cf371f1d89 to your computer and use it in GitHub Desktop.
Save bbdaniels/a3c9f9416f1d16d6f3c6e8cf371f1d89 to your computer and use it in GitHub Desktop.
Ben's useful boilerplate for Stata
** Load all the adofiles!
local adoFiles : dir `"${directory}/ado/"' files "*.ado"
local adoFiles = subinstr(`" `adoFiles' "', `"""' , "" , .)
foreach adoFile in `adoFiles' {
qui do "${directory}/ado/`adoFile'"
}
** Useful globals for everybody!
// Options for -twoway- graphs
global tw_opts ///
title(, justification(left) color(black) span pos(11)) ///
graphregion(color(white) lc(white) lw(med)) bgcolor(white) ///
ylab(,angle(0) nogrid) xtit(,placement(left) justification(left)) ///
yscale(noline) xscale(noline) legend(region(lc(none) fc(none)))
// Options for -graph- graphs
global graph_opts ///
title(, justification(left) color(black) span pos(11)) ///
graphregion(color(white) lc(white) lw(med)) bgcolor(white) ///
ylab(,angle(0) nogrid) ytit(,placement(left) justification(left)) ///
yscale(noline) legend(region(lc(none) fc(none)))
// Options for histograms
global hist_opts ///
ylab(, angle(0) axis(2)) yscale(off alt axis(2)) ///
ytit(, axis(2)) ytit(, axis(1)) yscale(alt)
// Useful stuff
global pct `" 0 "0%" .25 "25%" .5 "50%" .75 "75%" 1 "100%" "'
global numbering `""(1)" "(2)" "(3)" "(4)" "(5)" "(6)" "(7)" "(8)" "(9)" "(10)""'
global bar lc(white) lw(thin) la(center) fi(100) // ← Remove la(center) for Stata < 15
// Enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment