Thanks Nick for the "ge" addition to 'groups', works great.
Maarten Buis wrote:
-tabulate- is a built-in command (i.e. it is part of the
executable, not written in ado or mata), so it is unlikely
that any user written command can improve on that.
That's right and I didn't expect that.
What I meant to write is that calculations can take significant time in big datasets.
Performance example (Dual Core PC, 2 Gig Ram, Stata 11 MP):
1. One variable in a dataset
set rmsg on
set obs 2000000
gen x = int(uniform() * 10)
tab x // 0.44 sec.
groups x,show(freq rpercent) ge // 12.8 sec.
reversecum x // 5.0 sec.
2. 20 variables in a dataset
set obs 2000000
forval x = 1/20 {
gen x`x' = int(uniform() * 10)
}
tab x1 // 0,44 sec.
groups x1,show(freq rpercent) ge // 14.2 sec.
reversecum x1 // 29.2 sec.
BTW: The first time (0.44 sec.) reminds me of my first Stata experience a decade ago.
I worked with SPSS at university before and couldn't believe how fast Stata was.
(instant tabulate results...wow)
Thanks again
Stefan
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/