Wednesday, February 22, 2006

st: long macro

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: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

* * For searches and help try: * * *


Links to this post:

Create a Link

<< Home

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