asdocx: Export from Stata to Word, Excel, LaTeX & HTML › Forums › asdocx Forum › How to sort by total in asdocx tabulate command.
-
AuthorPosts
-
Thank Dr Shah,
I purchased and setup asdocx already,
I run a command:
asdocx tabulate hospitalname dischartypeThe result show data sort by name of hospital, not by total case.
How can I add sort by total value option to asdocx tabulate command.Many thanks,
Ha Thai Son
Hello Ha Thai Son
I have added option
sort
with thetabulate
command. To get the latest version, please type:asdocx_update
See the following two examples:
asdocx tab rep78 ----+----------------------------------------------------------------------------- 1 |Repair Record 1978 Freq. Percent Cum. ----+----------------------------------------------------------------------------- 2 |1 2 2.90 2.90 3 |2 8 11.59 14.49 4 |3 30 43.48 57.97 5 |4 18 26.09 84.06 6 |5 11 15.94 100.00 7 |Total 69 100.00 ---------------------------------------------------------------------------------- * Using option sort asdocx tab rep78, sort ----+----------------------------------------------------------------------------- 1 |Repair Record 1978 Freq. Percent Cum. ----+----------------------------------------------------------------------------- 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.1 6 |1 2 2.90 100 7 |Total 69 100.00 ----------------------------------------------------------------------------------
Thank you Dr. Shah,
It work well in one variable tabulate command, but more than one var, those option has no effect.
You are right, I need to work on the tabulate two-ways command to accept the
sort
option. That will take a while.I’m still waiting update version for sorting in cross-table tabulate command. Pls !
Hello Ha Thai Son
asdocx follows the native Stata commands. I think option sort is not allowed in two-way tabulationssysuse auto, clear tab rep78 foreign, sort option sort not allowed r(198);
I try to run with tabsort, but it failed
Ha Thai Son
tabsort
is not a Stata official command, therefore, asdocx does not know about it. This program was written by Nick Cox and one has to install it. If you want to use asdocx withtabsort
, here is the modified version oftabsort
that uses asdocx inside its main body. If you run this modified tabsort, it will generate the asdocx output. To run it, you need to first copy and paste it in the C:/ado/plus/t folder or other Stata folders where Stata can find it. [Download the modified tabsort here]* Load auto data sysuse auto, clear tabsort rep78 ------------------------------------------------------- 1 |Repair Record 1978 Freq. Percent Cum. ----+-------------------------------------------------- 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 ------------------------------------------------------- * With two variables tabsort foreign rep78 --------------------------------------------------------------------- 1 | Car type6 Repair Record 1978 ----+---------------------------------------------------------------- 2 | 1 3 4 5 2 1 Total 3 | Domestic 27 9 2 8 2 48 4 | Foreign 3 9 9 0 0 21 5 | Total 30 18 11 8 2 69 ---------------------------------------------------------------------
Since this is a very basic version of asdocx implementation, please do not expect much from it in terms of other asdocx options.
Thank Dr Shah, that what I need.
I use MacOsX, so the path to ado folder is: /Applications/Stata/ado/base/t -
AuthorPosts
- You must be logged in to reply to this topic.