For those who are not yet familiar with asdoc, asdoc can be downloaded from SSC and can be used with almost all Stata commands. Here is a short blog post that shows how asdoc can be used with any Stata command. You can also watch several YouTube videos that show the use of asdoc
ssc install asdoc
Since asdoc uses RTF file format, any Unicode character passed from Stata to the RTF file will be incorrectly shown in the output file. For example, a variable has the following value label which is correctly shown on Stata screen, but when written with asdoc, it is distorted.
Stata view: Don’t know asdoc view:
If you have Stata 14 or higher, then the good news is that you can use unicode command to change the file encoding. Specifically, the subcommand convertfile of unicode command can be extremely useful here. In the following example, I shall download an example dataset, called unicode.dta from my site, and then tabulate the variable M25 with asdoc, write the results to Myfile.doc and convert the coding and write the results to a new file, Myfile_new.doc
use http://fintechprofessor.com/unicode.dta, clear
asdoc tab M25, replace
The file generated by asdoc looks like this, the last line of the file highlights the given issue.
Now lets try the unicode solution.
unicode convertfile Myfile.doc Myfile_new.doc, dstencoding(Windows-1252) replace