[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: getting a list into a macro
At 03:28 PM 9/26/2008, Rich wrote:
I have a string variable that is 6 characters long -- about 100 observations
I want to get each value into one long macro with spaces between
each value -- how can I do that?
Thanks,
If I understand correctly, you want one macro, with all the values.
forvalues j = 1/`=_N' {
local m "`m' `=myvar[`j']'"
}
This puts an extra space at the beginning. There are ways to avoid it
if that's a problem -- such as:
forvalues j = 1/`=_N' {
local m "`m'`sp'`=myvar[`j']'"
if `j' ==1 {
local sp " "
}
}
HTH
--David
*
* 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/