- Notifications
You must be signed in to change notification settings - Fork 36
Description
I work with a bunch of former and current SAS programmers and have gotten use to the using the SAS PROC FREQ for checking our data construction. It's really handy. There is a tablist command for Stata, but it's really slow because it amounts to running preserve, contract, and then restore.
I would like to extend the gtools package to give similar output as tablist. This should be very easy since the heavy lifting could be borrowed from your gtoplevelsof.ado command. Consider the following example:
. sysuse auto (1978 Automobile Data) . gtoplevelsof rep78 foreign make rep78 foreign make | N Cum Pct (%) Cum Pct (%) -------------------------------------------------------------------------- 1 Domestic Olds Starfire | 1 1 1.4 1.4 1 Domestic Pont. Firebird | 1 2 1.4 2.7 2 Domestic Cad. Eldorado | 1 3 1.4 4.1 2 Domestic Chev. Monte Carlo | 1 4 1.4 5.4 2 Domestic Chev. Monza | 1 5 1.4 6.8 2 Domestic Dodge Diplomat | 1 6 1.4 8.1 2 Domestic Dodge Magnum | 1 7 1.4 9.5 2 Domestic Dodge St. Regis | 1 8 1.4 10.8 2 Domestic Plym. Volare | 1 9 1.4 12.2 2 Domestic Pont. Sunbird | 1 10 1.4 13.5 -------------------------------------------------------------------------- Other | 64 74 86.5 100.0 At first glance, it appears two main changes would be required.
- Default to showing all combinations of
varlist, rather than truncating at the first 10. I tried just settingntop()to some really big number (e.g.,ntop(1e12)) but when I do that I get an error aboutmatsizenot being large enough. I'm not sure why that's a problem since I thought your back end was in Mata. - Provide options for sorting the table by frequency or sorting by `varlist'.
You could get fancy with other other formatting options, but the two edits above are key.
I'd be happy to help. I just need some help sorting through the gtools stuff. My first attempt recieved errors when it hit _gtools_internal.