This might be already implemented in the most recent version of Stata, but I just came across the problem that there seems to be no straightforward way to combine a kernel density plot (i.e. kdensity) with a normal distribution of the underlying variable.
Continue reading Add normal distribution to kernel density plot in StataSubscribe to our newsletter
Some time ago, we started a newsletter to keep you updated with the latest posts and interesting information related to Stata and LaTeX. To get email updates straight go your inbox, please subscribe here – we promise that we don’t spam you!
Information about Stata macros: number of elements and order within locals and globals
Especially when running loops (see our posts here), it can be important to get more information about a macro, such as the length, or its first or last element.
Continue reading Information about Stata macros: number of elements and order within locals and globalsUseful string functions in Stata (updated list)
Most often when I search the internet for help on Stata, it is probably when I need to work with string variables (such as names). There are some very good summaries that cover aspects of string variables (e.g., this page). In this post –which will be continuously updated– we present random string functions that we think are extremely useful for Stata users.
Continue reading Useful string functions in Stata (updated list)Format how locals are displayed in Stata
Often I use locals to calculate something (such as the mean of a variable for a specific group) and use this in a loop (say, over groups or over years). If you, for example, want to calculate the share of observations that belong to one group (say: female==1
), you could simply write
Piecewise execution of do-files in Stata
Do-files in Stata easily get a bit lengthy. Of course, you can try to shorten do-files and distribute code onto several do-files and have one master file that runs all of the respective sub-do-files (which are included by do dosubfile1.do
). Alternatively, you can leave the do-file longish but write your code such that you only run parts of the code at once:
Numbering in LaTeX documents
Manuscripts typically contain many different types of numbering: page numbering, sections, subsections, figures, tables etc.
Continue reading Numbering in LaTeX documentsMultiple lines commands in Stata
Many Stata commands get easily quite long. Take, for example, a command to generate a figure – possibly the layout definitions are quite lengthy and difficult to read. Stretching commands over several lines makes it much easier to write and read, and less prone to errors.
Continue reading Multiple lines commands in StataEquation numbering in Microsoft Word
From time to time, I need to write articles in Microsoft Word. When I then also need to include Equations in the Word document, I realise (again) why I so much prefer to use LaTeX. Today I came across a simple way of having Equation numbering included in a word document (although it is natively not supported). Well, it is supported but only above or below a formula…
Continue reading Equation numbering in Microsoft WordEconomics journals BibTex styles (.bst)
Over and over again we were searching for BibTeX styles files (.bst) that follow the required styles of specific journals. So we decided to create a list ourselves. If you have any additions or corrections, please lets us know!
Continue reading Economics journals BibTex styles (.bst)