Statalist The Stata Listserver


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

st: Can a global macroname act as a prefix?


From   Steven Samuels <ssamuels@albany.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Can a global macroname act as a prefix?
Date   Tue, 8 May 2007 08:07:06 -0400

Local variables can act as prefixes and suffixes in variable names:

local a = "local"
gen `a'_x = 1 // create local_x
gen x_`a'= 1 // creates x_local

global b= "global"
gen x_$b= 1 // creates x_global

gen $b`a'= 1 // creates globallocal

My question: Can I create something a variable named "global_x" using the global variable $b ?

Thanks

Steve




*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index