Statalist The Stata Listserver


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

RE: st: RE: Understanding the difference between gen and egen


From   Richard Williams <[email protected]>
To   [email protected]
Subject   RE: st: RE: Understanding the difference between gen and egen
Date   Wed, 14 Jun 2006 09:31:49 -0500

At 03:14 AM 6/14/2006, Nick Cox wrote:
I am not knocking -egen-. I may be its greatest
fan in the Stata community. I have found it helpful
in my own work to be able to use, and to write -egen-
functions. But it is not, itself, an enormous deal. It is at root
a rag-bag of convenient short-cuts. For example,
if -egen, total()- did not exist, we could get
there typically in two lines instead of one,
as in

bysort bar: egen foototal = total(foo)

being done by

bysort bar : gen foototal = sum(foo)
by bar: replace foototal = foototal[_N]
I think that may understate egen's value a bit. True, as far as typing goes, it may sometimes only save you a line or two. But for many people it will also save the several hours it would take to figure out what those two or three lines would be!


-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* 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