Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Maximum length of macros


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Maximum length of macros
Date   Fri, 11 Jun 2004 16:56:04 +0100

The limit that is biting here is not the maximum 
length of macros, but the maximum length of 
a string expression. See help on -limits-. 

Your use of the equals sign = may seem innocuous but it causes 
Stata to evaluate what lies to the right of it. In cases like this, 
just copy the list without evaluating it. Your macro is 
being truncated after 80 characters, it seems. (12 is the number 
of words.) 

. local w "pop young old male MSA countyhospice pctblack pctrural 
pctold charscore ipdays opdays tot_hos oppaid totalpaid"

See also [U] 21.3.4 (p.196 in version 8 edition). 

Nick 
[email protected] 

F. Michael Kunz
 
> How many characters can a local or a global store? I need to store a 
> variable list in a macro and it is being truncated after the 12 
> character. Changing from local to global is not of any help 
> nor is using 
> double quotes (have tried). Can anyone give me some advice on how to 
> handle this problem?
> 
> Thanks!
> 
> Code:
> 
> . local w = "pop young old male MSA countyhospice pctblack pctrural 
> pctold charscore ipdays opdays tot_hos oppaid totalpaid"
> . local z: word count `w'
> . display `z'
> 12
> . display "`w'"
> pop young old male MSA countyhospice pctblack pctrural pctold 
> charscore 
> ipdays op

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