sysuse auto
generate myvar=substr(make,1,6)
forvalues i=1/`=_N' {
local mylist `"`mylist' `=myvar[`i']'"' /* do not put equal sign
after local mylist */
}
display `"`mylist'"'
If you expect spaces among your 6 characters you might want to enclose
`=myvar[`i']' in quotes as well. same if some observations have
missings.
Regards, Sergiy Radyakin
On Fri, Sep 26, 2008 at 3:28 PM, Richard Goldstein
<[email protected]> 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,
>
> Rich
> *
*
* 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/