Overlaying histograms in Stata

For analysing data and comparing distributions, I often want to overlay two histograms. Without further options, however, one distribution usually overlays the other and makes comparisons cumbersome. It is possible to set a few options to make the figure look nice. Continue reading “Overlaying histograms in Stata”

Formatted numbers in figure (sub)headers

There is a very nice and simple trick to include numbers (such as: number of observations, R2s or any other number that can be saved to a local) in Stata figures. While including numbers can be simply done with a local, the trick is to have them nicely formatted. I.e., to include commas in a larger number, or to have decimals rounded. Continue reading “Formatted numbers in figure (sub)headers”

Track Changes in LaTeX and compare documents

One big disadvantage of writing in LaTeX compared to writing in other software, such as Word, is that its absence of track changes. Although there are ways to do track changes, such as the online tex-editor Sharelatex or the trackchanges package, I have sticked to commenting out deleted parts of the text, or by highlighting new passages in red. Continue reading “Track Changes in LaTeX and compare documents”

Use images from pdf documents in Latex

While you can simply drag & drop images in MS Word or Powerpoint, doing this in Latex requires a few more steps. An important difference is that in Latex, you first need to save the copied file as a separate image file which can then be included in the Latex code. For this purpose, we need a decent image editor. I recommend using Continue reading “Use images from pdf documents in Latex”

Data storage type matters

Despite most sources tell that the storage type in stata should not matter, it is worth checking whether this is the case for your dataset. I just came across a situation where two identically constructed datasets (one stored in default type (float) and one stored in double) generated different output. Also before that i encountered a problem with person identifiers in the GSOEP if using the default data storage. If your dataset is not huge (with the GSOEP it still works quite ok) it might be worth to take the safe side and use

 set type double 

before you assemble your data set. This saves the data in the most precise way stata offers.

Turning Footnotes into Endnotes …

Submitting (LaTeX) written papers has some advantages: one usually does not have to change any formatting manually. LaTeX does that for us if it is instructed to do so. Journals often want the submissions to be formatted in a peculiar way. My challenge was to change footnotes to endnotes. I did remember that it was easy in LaTeX, but not how it was done, so Google had to help me …
Continue reading “Turning Footnotes into Endnotes …”

Preamble when switching between OS X and Windows

A problem when working on one and the same project on different platforms (here: Windows and Mac/OS X) is that path-names differ. There are two straightforward solutions to this:

1) When defining a number of different path (e.g. one path where data is stored, one where results/output is stored), it is handy to define the paths as globals and to add an “if” condition. The platform can be detected by the local `c(os)’: Continue reading “Preamble when switching between OS X and Windows”