Statalist The Stata Listserver


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

Re: st: long macro


From   "Seb Buechte" <[email protected]>
To   [email protected]
Subject   Re: st: long macro
Date   Wed, 22 Feb 2006 16:50:32 +0100

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 <[email protected]> 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: [email protected]
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> *
> *   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/
>


--
- Seb F Buechte
-
- Stay tuned!

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index