RSS syndicated content from Statalist, a discussion listserv generated by users of StataCorp Stata statistical analysis software. Subscribe to the RSS feed using the links provided in the sidebar. You must join the listserv in order to respond to, or add, new posts. For more information on Statalist, click on the 'Statalist FAQ' link in the sidebar.

Wednesday, February 22, 2006

Re: st: long macro

It looks to me like you are entering a "string" into the local macro
and strings in Stata are limited to 244 characters. You may to try
this:

local i=1
local codelist
while `i'<= _N {
local codelist `codelist' `=icd10code[`i']'
local ++i
}

Seb

On 2/22/06, Dedman, Dan <D.Dedman@ljmu.ac.uk> wrote:
> Dear All
>
> I was trying to create a macro that contained a long list of (icd10) codes that are stored in a temporary dataset. There are 290 obs and icdcode is str4 variable, so I reasoned that thereshould not be any problem storing this many characters in a macro. Intercooled stata has a limit of around 68000 characters in a macro, so I was surprised to find that the that the code works fine until "`codelist'" reaches 244 characters in length. After that it fails to grow in subsequent iterations.
>
> My code looks like this:
> <snip>
> version 9
> local i=1
> local codelist
> while `i'<= _N {
> local codelist = "`codelist'" + " " + icd10code[`i']
> local ++i
> }
> <snip>
>
> What am I doing wrong?
>
> Many thanks
>
> Dan Dedman
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> Daniel Dedman
> Public Health Information Specialist/Analyst
> North West Public Health Observatory
> Centre for Public Health
> Castle House
> North street
> Liverpool L3 2AY
>
> t: 0151 231 4508
> m: 07812 192578
> f: 0151 231 4515
> e: d.dedman@ljmu.ac.uk
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> *
> * 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/
>