Friday, March 17, 2006

st: Using local variables in the name of a global variable

Hi,

I want to define a global variable whose name contains 2 local variables (b/c I am creating it w/in nested loops over year & month):

forval y = 1980(1)2006 { forval m = 1(1)12 { global gooddaysY`y'M`m' = "stuff" di "$gooddaysY`y'M`m'" } }

Suppose we are in the y = 1980 & m = 1 loop. Then the result of the -display- is: 1980M1. I am guessing this has something to do w/ the quotes. But I don't know how to fix it. Any ideas?

Thanks, Danielle Ferry

-- National Bureau of Economic Research <http://www.nber.org>

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


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?