Thursday, March 16, 2006

Re: st: looping over parallel lists - is there a alternative to "for"?

On Mar 16, 2006, at 12:13 PM, Nick Cox wrote:

> I don't particularly yearn for that, nor I do argue against. > > But what you can do now -- and indeed for some time past -- is not > far away: > > foreach element of loc mylist { > tokenize `element' > args numeral letter roman > ... > } > > If there was a lot in the loop this would make code clearer.

Ah yes, very nice. It had never occurred to me to use -args- in this way (i.e., after a manual call to -tokenize- as opposed to the automatic tokenization of command line arguments). I retract my earlier suggestion, and thank you for the tip.

-- Phil

* * 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/


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?