Statalist The Stata Listserver


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

RE: st: Padding zeros, writing functions


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Padding zeros, writing functions
Date   Sun, 28 Jan 2007 17:16:57 -0000

The implication of a hierarchy is not mine, but Stata's. 
-egen- functions are definitely second-class citizens, 
in so far as you can only use them in -egen- commands. 

Your regular expression shopping list would interest 
people who use them. Otherwise this is the same story as
before: there are supposedly lots of examples, it is just that 
you are unwilling to give even one that can be discussed 
precisely! 

Nick 
[email protected] 

Ari Friedman
 
> I don't disagree that it can often be done other ways if one 
> looks hard
> enough, but there are definitely times where it would be nice 
> to write a
> function to do quick things over and over, particularly where 
> a function
> relates to locals and thus requires at least two lines were 
> it written as a
> Stata command (one to call the function, one to assign the 
> returned value to
> a local).  I'm not sure I entirely agree with the heirarchy 
> that you've set
> up, however, in that I don't know that moving a feature from 
> a command to a
> function necessarily represents a "promotion."  It's 
> certainly a different
> way of doing things, but whether it's better or not entirely 
> depends on the
> context.  
> 
> Given that I've conceded that most things can be done other 
> ways, I'm going
> to have to decline your challenge.  The only statement I will 
> make to that
> effect aside from the aforementioned 'doing simple 
> modifications of locals
> in-line' is that a more complete implementation of regular 
> expressions would
> be helpful.  A comparison to Perl leaves Stata's implementation rather
> humbled--and, although it's not necessarily fair to take the strongest
> feature of one language and compare it to one of the weaker 
> features of
> another, nevertheless in day-to-day use powerful regular 
> expressions are
> wonderful things to have in one's arsenal.
 
Nick Cox
 
> In terms of evidence for this assertion: 
> scan the list of 
> - -egen- functions, official and user-written, 
> to see what really deserves to be promoted to
> a Stata function. 
> 
> Or here's a challenge: if
> your statement is true, you should be able 
> to name a few functions that are missing from
> Stata. 
> 
> In my Stata programming, I can think of only 
> one program I've written that really was an 
> awkward substitute for a function, i0kappa.ado 
> on SSC. And next time round it will be 
> rewritten in Mata anyway. 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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