Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: modifying egen to add a replace feature


From   Maarten Buis <[email protected]>
To   [email protected]
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

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index