Statalist The Stata Listserver


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

st: RE: how to add specific letter to string macro


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: how to add specific letter to string macro
Date   Mon, 8 May 2006 15:48:32 -0500

Try -foreach-

For example:
local x  "a b c d e"
foreach l of local x {
	local wx "`wx' w`l'"
	}
disp "`wx'"

Scott


> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Oleksandr Shepotylo
> Sent: Monday, May 08, 2006 3:35 PM
> To: Stata; Oleksandr Shepotylo
> Subject: st: how to add specific letter to string macro
> 
> Dear Statalist users,
> 
> Suppose that I have a local macro
> 
> loc X = " a  b  c"
> 
> I want to create a local macro
> 
> loc WX="wa wb wc"
> 
> The problem is that I want to automate the process and write a code that
> will create `WX' based on string stored in `X'.
> 
> Can anyone help me with this?
> 
> Thanks,
> 
> Oleksandr Shepotylo.


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