[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: converting macros into variables

From   "Kieran McCaul" <>
To   <>
Subject   st: RE: converting macros into variables
Date   Fri, 13 Feb 2009 14:38:14 +0900

gen `v' = ``v''

Kieran McCaul MPH PhD
WA Centre for Health & Ageing (M573)
University of Western Australia
Level 6, Ainslie House
48 Murray St
Perth 6000
Phone: (08) 9224-2140
Fax: (08) 9224 8009
The fact that no one understands you doesn't make you an artist.

-----Original Message-----
[] On Behalf Of Luhang Wang
Sent: Friday, 13 February 2009 1:05 PM
Subject: st: converting macros into variables

Hi All,
Does anyone know an easy way of converting macros into variables?
I'm trying something like the following.
local x1=1
local x2=2
local vl "x1 x2"
foreach v of loc vl {
        gen "`v'"=`"`v'"'
I end up with error message
"x1 invalid name
How to interprete this?
I guess there is better method to achieve the goal. Any hint will be
*   For searches and help try:

*   For searches and help try:

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