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]
st: RE: operations on macro elements
From
Nick Cox <[email protected]>
To
"'[email protected]'" <[email protected]>
Subject
st: RE: operations on macro elements
Date
Wed, 16 May 2012 18:01:28 +0100
Maarten Buis, Phil Clayton and Daniel Klein all responded quickly to this and their answers all have similar flavour: You can (indeed should) think that this is something that you can program easily, regardless of whether there is a dedicated extended macro function, say with a loop over the words inside the macro.
I agree, and what follows is just a footnote to that thread.
There is an outdated package called -listutil- on SSC, which predated both -foreach- and -forval- on the one hand and extended macro functions on the other. It arose because there were lots of questions on the list round about 12 years ago about manipulating macros that were lists. So, -postlist- in -listutil- is one answer to your question. That kind of discussion led to StataCorp sorting out the area by introducing a bundle of extended macro functions.
But don't use -listutil-! Writing your own loop is much better for you.
Nick
[email protected]
Abhimanyu Arora
I have a macro say, x containing the string "a b c"
I would like to have a macro y such that y contains the string "a_1
b_1 c_1" ? Is there a simple way using sort of extended functions?
*
* 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/