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: operations on macro elements


From   daniel klein <[email protected]>
To   [email protected]
Subject   Re: st: operations on macro elements
Date   Wed, 16 May 2012 14:59:47 +0200

Abhimanyu,

I am not aware of an extended function for this, but a simple loop
might suffice.

loc x "a b c"
foreach k of loc x {
    loc y `y' `k'_1
}
di "`y'"

Best
Daniel

-- 
Dear statalist
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?
Many thanks
Cheers
Abhimanyu
*
*   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