In a text, you often you refer to a number (e.g. the number of observations in the estimation sample). There is a simple way to automise the export of this number from a Stata-do-file to a Latex-document. It works by generating another latex-document, which contains this number only. This newly created file can be included in the main latex-document. Here is how it works (example here: number of observations, where id
is the identifier for individuals):
tab id
file open newfile using numberofobs.tex, write replace
file write newfile “`r(r)’”
file close newfile
This syntax generates the number of distinct values of variable id
.
Leave a Reply
You must be logged in to post a comment.