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

Re: st: Macro operation

From   Bill Rising <>
To   "Stata Listserve" <>
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 

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

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index