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: What is EGEN_Varname and EGEN_SVarname ?


From   Nick Cox <[email protected]>
To   [email protected]
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 <[email protected]> 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
>> <[email protected]> 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: [email protected]
>>> [mailto:[email protected]] On Behalf Of Nick Winter
>>> Sent: Tuesday, July 31, 2012 8:41 AM
>>> To: [email protected]
>>> 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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index