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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: What is EGEN_Varname and EGEN_SVarname ?


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: What is EGEN_Varname and EGEN_SVarname ?
Date   Tue, 31 Jul 2012 09:26:35 -0500

Maarten already answered this. It's tacit in the help entry and
explicit in the manual entry I referenced that you can do this.

Nick

On Tue, Jul 31, 2012 at 9:05 AM, Daniel Feenberg <feenberg@nber.org> wrote:
>
> On Tue, 31 Jul 2012, Nick Cox wrote:
>
>> It's documented. See help on macro extended functions and the
>> corresponding manual entry. That is accessible by -help extended fcn-.
>
>
> Can you explain further? In the referenced help entry the colon operator
> appears only in the context of a -local- or -global- statement. In your
> example there is no such keyword, and the macro name is also missing. I
> suppose the colon operator defines a temporary macro but more explicit
> documentation would be welcome.
>
> daniel feenberg
>
>
>>
>> Nick
>>
>> On 31 Jul 2012, at 13:47, Pradipto Banerjee
>> <pradipto.banerjee@adainvestments.com> wrote:
>>
>>> Nick, That's very interesting. I wasn't aware that this kind of usage of
>>> ":" is possible. It's another undocumented feature.
>>>
>>>
>>> -----Original Message-----
>>> From: owner-statalist@hsphsun2.harvard.edu
>>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Winter
>>> Sent: Tuesday, July 31, 2012 8:41 AM
>>> To: statalist@hsphsun2.harvard.edu
>>> Subject: Re: st: What is EGEN_Varname and EGEN_SVarname ?
>>>
>>> Not that this is the advice you are looking for, but I tend to solve
>>> this sort of problem like this:
>>>
>>> local newvars test1 test2
>>> local oldvars price mpg
>>>
>>> forval i=1/`: word count `newvars'' {
>>>  egen `: word `i' of `newvars'' = sum(`: word `i' of oldvars'')
>>> }
>>>
>>> or
>>>
>>> local newvars test1 test2
>>> local ptiles 10 90
>>>
>>> forval i=1/`: word count `newvars'' {
>>>  egen `: word `i' of `newvars'' = pctile(price), p(`: word `i' of
>>> ptiles'')
>>> }
>>>
*
*   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   |   Site index