Statalist


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

Re: st: RE: egen & sum()


From   Neil Shephard <nshephard@nhs.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: egen & sum()
Date   Wed, 26 Nov 2008 10:16:10 +0000

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).

Neil

-- 
"We should make things as simple as possible, but not simpler" - Anon (not Albert Einstein)


***********************************************************************
This  message  may  contain  confidential and  privileged  information.
If you  are not the  intended recipient  you should not  disclose, copy
or distribute information in this e-mail or take any action in reliance
on its contents.  To do so is strictly  prohibited and may be unlawful.
Please  inform  the  sender that  this  message has  gone astray before
deleting it.  Thank you.

2008 marks the 60th anniversary of the NHS.  It's an opportunity to pay
tribute to the NHS staff and volunteers who help shape the service, and
celebrate their achievements.

If you work for the NHS  and  would like  an NHSmail  email account, go
to: www.connectingforhealth.nhs.uk/nhsmail
***********************************************************************

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index