Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: group option for generate

From   "Nick Cox" <>
To   <>
Subject   st: RE: group option for generate
Date   Wed, 8 Mar 2006 22:46:26 -0000

This function went undocumented in Stata 9. 

You can blame Svend Juul. Svend gave a very 
witty talk at a Berlin users' meeting pointing 
out functions and -egen- functions with the same name, but 
different definitions; the same definition, 
but different names; and much else besides. 

His talk is here:

So, StataCorp looked in the stables, and saw
that he was right. It was a mess. So, they 
went to work renaming, and tidying a few 
ancient oddities out of sight. 

Actually, you can blame me, as I recall
suggesting that this one be hidden, my 
argument being that -egen, group()-, 
although it came later, was far more 
useful and far more widely used. I 
still think that's true.  

-group()-, which is a function, not an option, 
is documented at version 8 [R] p.454. 

group(n) divides the data into n nearly 
equal groups, with integer values 1 to ceil(n). 
That depends on the current sort order. 

-group(varname)- appears equivalent to 

sort varname 
... = group(max of varname)
<sort back again>


roy wada
> Can someone tell me what kind of distribution is created by 
> -group( )- 
> option for -gen- command? I am using 9.1 for Windows.
> sysuse auto, clear
> gen repNew=group(rep78)

*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index