Statalist


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

st: simple data input question- expanding macros


From   <[email protected]>
To   <[email protected]>
Subject   st: simple data input question- expanding macros
Date   Fri, 15 Aug 2008 01:35:09 -0700

Hi, I apologize for such a simple question. I hope to eventually participate in statalist on a much higher level.

I would like to input data that I have in strings manually in a .do file.
That is, say I have a for loop going through a list of a bunch of strings, how can I use those strings to input data?

Say, I have a macro called color.
and, I have an existing dataset with blue and green as observations (there is only one variable, COL).
Why doesn't the following work:

local color = "red"
input
`color'
end

I tried the above code using a global variable as well, to no avail:

global color = "red"
input
${color}
end


Is there a better way to do this? How do I expand my macro before anything else happens?

Thank you!

PS. is there any good forum online that might be better for beginner questions?
_________________________________________________________________
Get Windows Live and get whatever you need, wherever you are.  Start here.
http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home_082008
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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