Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: egen & sum()


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: egen & sum()
Date   Wed, 26 Nov 2008 10:29:28 -0000

See my posting earlier in the thread for an answer to most of this. 

It is not customary to mention outdated names in the -help-. This
question gets asked about once a year on Statalist; that's not enough to
justify bloating the help further. (Neil being a Unix person calls it
-man-.) 

Although it's StataCorp call, there is no obvious reason why any of the
old names should ever stop working. The most obvious reason for change
is that StataCorp might want to reclaim some of them, but as said they
are now considered objectionable. 

Historians of Stata will recall that as each -egen- function is defined
in an ado file whose name begins "_g" -egen- functions in the olden days
when all files to be acceptable to DOS had to  fit an 8 + 3
filename.ext pattern had to be no more than _6_ characters long.
Naturally that no longer bites. 

Nick 
[email protected] 

Neil Shephard

Martin Weiss wrote:

> See - help whatsnew8to9- and search for "sum()"
>
> "The following egen functions have been renamed:
>
>                 old name    new name
>                 ------------------------
>                 any()       anyvalue()
>                 eqany()     anymatch()
>                 neqany()    anycount()
>                 rfirst()    rowfirst()
>                 rlast()     rowlast()
>                 rmean()     rowmean()
>                 rmin()      rowmin()
>                 rmiss()     rowmiss()
>                 robs()      rownonmiss()
>                 rsd()       rowsd()
>                 rsum()      rowtotal()
>                 sum()       total()
>                 ------------------------"
>   
Thanks Martin, your memory is clearly better than mine to remember that
from 2005!  I thought that might have been the case and had read -man
whatsnew- but hadn't gone back further (I also neglected to state that
I'm using Stata 10.1 born 11 Aug 2008)

I just checked a few others and it seems that the old names are still
valid (see continued examples below), presumably to provide a degree of
backwards compatability when running scripts under old versions?

. clear

. set obs 10
obs was 0, now 10

. gen a = _n

. gen b = sum(a)

. egen b2 = sum(a)

. egen b3 = total(a)

. egen c = rmean(b b2 b3)

. egen c2 = rowmean(b b2 b3)

. egen d = rlast(b b2 b3)

. egen d2 = rowlast(b b2 b3)

. egen e = rmin(b b2 b3)

. egen e2 = rowmin(b b2 b3)

. list

     +-------------------------------------------------------------+
     |  a    b   b2   b3          c         c2    d   d2    e   e2 |
     |-------------------------------------------------------------|
  1. |  1    1   55   55         37         37   55   55    1    1 |
  2. |  2    3   55   55   37.66667   37.66667   55   55    3    3 |
  3. |  3    6   55   55   38.66667   38.66667   55   55    6    6 |
  4. |  4   10   55   55         40         40   55   55   10   10 |
  5. |  5   15   55   55   41.66667   41.66667   55   55   15   15 |
     |-------------------------------------------------------------|
  6. |  6   21   55   55   43.66667   43.66667   55   55   21   21 |
  7. |  7   28   55   55         46         46   55   55   28   28 |
  8. |  8   36   55   55   48.66667   48.66667   55   55   36   36 |
  9. |  9   45   55   55   51.66667   51.66667   55   55   45   45 |
 10. | 10   55   55   55         55         55   55   55   55   55 |
     +-------------------------------------------------------------+


Should these synonyms be mentioned in -man egen- or will they quietly
fade away in subsequent releases?  (I guess Stata Corp. are the only
people who might answer that).


*
*   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/



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