Statalist The Stata Listserver

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

st: Re: understanding the difference between gen and egen

From   Kit Baum <>
Subject   st: Re: understanding the difference between gen and egen
Date   Wed, 14 Jun 2006 08:35:01 -0400

Dick is caught by a historical issue here. Prior to Stata 9, you could say

gen foo = sum(bar)
egen foo = sum(bar)

which was indeed confusing, given that the gen produced a RUNNING sum and the egen produced a total. Wisely, Stata's developers renamed the egen function to total().

With respect to the wide array of non-official Stata capabilities (for the accessibility of which I am somewhat responsible) the Stata command findit will locate anything that is in the Stata Journal, Stata Technical Bulletin, or the SSC Archive which I maintain. Anything you find in the SSC Archive can be described with the ssc command, and installed likewise. Bill Gould's new official "adoupdate" command makes it as easy to keep user-installed stuff up to date as official Stata components. So yes, Stata is more confusing that a program fully described by a printed manual. Even official Stata is not fully documented by the version 9 manuals, given significant additions since 9.0. But "help whatsnew" and "help forthcoming" will assist with that.

Official Stata is a very dynamic organism, with significant enhancements during the life of a major version. When the user- written components made available through the Stata Journal and SSC Archive are taken into account, you literally have to check daily for what has been newly developed if you want to be fully au courant. (I added a number of new routines this week that had been in a backlog during my absence; "ssc whatsnew" will show them, with links to their descriptions). Admittedly this can be confusing; but it is also one of Stata's great virtues and comparative advantages over many alternative statistical languages.

PS> Confronted with 6 feet + of manuals on a shelf for Some Alternative Software, some users are comforted?

Kit Baum, Boston College Economics

On Jun 14, 2006, at 2:33 AM, Dick wrote:

I am now a confirmed Stata user and love it for all the reasons
that Phil Schumm outlined the other day and more. But the recent
note from a user regarding sums within id reminds me of how
difficult it is sometimes for new users to get a handle on relatively
simple things. In the current case, if I look up "sum" in the master
index, I am directed to -egen-. If I go to -egen-, somewhat surprisingly,
I don't find -sum- listed in the list of egen functions beginning on page 101
of the Data Management manual or summary of that list on page 105.
Nor is it available in the drop down list of egen functions
I can do -sum- as a function using -gen- but then I get a running sum, not
a total.

It struck me that perhaps -help egenmore- would show me the sum function.
but no luck. A little further digging led me to the documentation for the
- -sum- function
on page 157 which tells me that I can get a running sum and which directs
me to an "alternative sum function" in -egen-. What I did eventually find in
the documentation for -egen- was the -total- function which does indeed
produce a sum. But so does the -sum- function, so one is apparently an
alias for the other.
*   For searches and help try:

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