asdocx: Export from Stata to Word, Excel, LaTeX & HTML › Forums › asdocx Forum › Value labels diassapear when using the sort option › Reply To: Value labels diassapear when using the sort option
I have fixed this. The error was caused by the sort
function of Mata. Sorting numbers that are stored as string does not work as expected. I had to find an alternative algorithm and now the sort option works on both string and numbers. See the following examples
asdocx_update sysuse census * The case where labels are string asdocx tab region, replace sort 0 |1 2 3 4 ----+-------------------------------------------------------------------------------------- 1 |Census region Freq. Percent Cumulative Freq. ----+-------------------------------------------------------------------------------------- 2 |South 16 32.00 32.00 3 |West 13 26.00 58.00 4 |N Cntrl 12 24.00 82.00 5 |NE 9 18.00 100.00 6 | Total 50 100.00 ------------------------------------------------------------------------------------------- * The case where labels are numbers sysuse auto, clear asdocx tab rep78, replace sort Tabulation of rep78 0 |1 2 3 4 ----+-------------------------------------------------------------------------------------- 1 |Repair record 1978 Freq. Percent Cumulative Freq. ----+-------------------------------------------------------------------------------------- 2 |3 30 43.48 43.48 3 |4 18 26.09 69.57 4 |5 11 15.94 85.51 5 |2 8 11.59 97.10 6 |1 2 2.90 100.00 7 | Total 69 100.00 -------------------------------------------------------------------------------------------