Formatting text in Stata figures

This is not really new, but still comes in handy when formatting text in Stata figures. With a relatively simple code, you can make write text bold, in italics, and even greek letters

This special text is entered in curly brackets “{…}”:

  • Greek letters: {&alpha}, {&beta}, etc.
  • Text in italics: {it:Text in italics}
  • Text in bold: {bf: Text in bold}
  • Operators: {&le} (less than or equal to), {&ne} (unequal)
  • Subscripts and superscripts: e.g., write y{sup:2}{sup:ij}

Follow new journal articles via RSS-feeds

When I started, I mainly checked new articles of my favorite journals and working paper series through email newsletters. To avoid to get too many emails, you can also subscribe to new articles through RSS-feeds (Really Simple Syndication). For me, the main advantage is that I can easily scroll through a lot of new articles at once in one place.

Continue reading

Include entire PDF files in your LaTeX document

I described already earlier how to use images in pdf format in your LaTeX document, e.g. if you want to include a screenshot of a Table of a paper in pdf format in your slides (which results in much better quality than using jpg or similar formats).

But what if you want to include complete pages of a document or even complete pdf documents? I have used the latter for example as a reliable tool to append pdf documents, such as papers.

Continue reading

Routine to export tables from Stata to LaTeX

When it comes to exporting regression tables from Stata to LaTeX, there are several packages that can be used. For a long time, I used outreg2, but now improved my code for the the estout package by Ben Jann. The remainder of this post describes the routine that works best for, you might want to adjust it for your own purposes. (I actually have written about this package before, this post presents a more elaborated code.) Continue reading

Standardize variables by group

Unfortunately, the otherwise great Stata command egen does not allow to standardize variables group, e.g. for each year separately. There is a small get-around by calculating mean and SD first, and then manually creating the standardized the variable (and then you really wonder why this is not implemented in Stata).

* StandardizeVAR by year
by year: egen VAR_mean= mean(VAR)
by year: egen VAR_sd = sd(VAR)
by year: gen VAR_std = (VAR-VAR_mean)/VAR_sd

or, if you need to do it for several variables at once

* StandardizeVAR1 VAR2 VAR3 by year
foreach var of varlist VAR1 VAR2 VAR3 {

by year: egen `var'_mean= mean(`var')
by year: egen `var'_sd = sd(`var')
by year: gen `var'_std = (`var'-`var'_mean)/`var'_sd
}