Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: modifying egen to add a replace feature

From   Maarten Buis <>
Subject   Re: st: modifying egen to add a replace feature
Date   Thu, 19 Jul 2012 09:13:31 +0200

On Wed, Jul 18, 2012 at 5:00 PM, Pradipto Banerjee wrote:
> Is it possible to rewrite or modify egen, or create an ado file, such that I can simply write like this:
> bysort x: egen y = myfunc (y, a, b, ...), replace

Yes, the logic behind the way -egen- works is that if you type -egen y
= myfunc()-, -egen- will look for a file _gmyfunc.ado, which
implements the function myfunc() and it also passes the option you
have specified to that .ado file. So you can write your own -egen-
functions. The easiest way to get started is to look at an existing
similar function and addept that, e.g. look at -viewsource _gmean.ado.

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index