Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Macro operation


From   Bill Rising <[email protected]>
To   "Stata Listserve" <[email protected]>
Subject   Re: st: Macro operation
Date   Mon, 5 Aug 2002 16:54:43 -0400

On 8/5/02 16:38, Li, Wenjun wrote

>A quick question about macro operation: 
>
>I have a long list of names that are stored in a macro, such as
>	local namelist `aa bb cc def ghi .....................'
>I would like to change them to 
>	local namelist2 'aa_g bb_g cc_g def_g ghi_g ................' etc. 
>
>How could I do that?
>

The following would work (either from the command window or in an (a)do 
file):

foreach name of local namelist {
  local newlist "`newlist' `name'_g"
  }

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