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

Re: st: Maximum length of macros


From   Sergey.V.Chernenko@frb.gov
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Maximum length of macros
Date   Fri, 11 Jun 2004 12:03:56 -0400



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

tells Stata to evaluate right-hand side and store it in w. Stata's
expression parser however is limited to handling strings of 80 characters
in Intercooled Stata. This is why your string was truncated. You should use
instead

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

which simply copies your string to w. Copying is limited by the maximum
lenght of a macro which is 67,784 characters, plenty enough for most
purposes.

You can refer to [U] 21.3.4 Macros and expressions.

Sergey





                                                                                                                                              
                      "F. Michael Kunz"                                                                                                       
                      <kunzf@musc.edu>                  To:      statalist-digest@hsphsun2.harvard.edu                                        
                      Sent by:                          cc:                                                                                   
                      owner-statalist@hsphsun2.         Subject: st: Maximum length of macros                                                 
                      harvard.edu                                                                                                             
                                                                                                                                              
                                                                                                                                              
                      06/11/2004 11:19 AM                                                                                                     
                      Please respond to                                                                                                       
                      statalist                                                                                                               
                                                                                                                                              
                                                                                                                                              




Dear Statalisters:

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







--
=========================================================
F. Michael Kunz, M.A.
Senior Research Associate
Center for Health Economic and Policy Studies

Medical University of South Carolina
Department of Health Administration and Policy
19 Hagood Avenue, 408 Harborview Tower
P.O. Box 250807
Charleston, South Carolina 29425

PH (843) 792-4225
FAX (843) 792-1358

E-mail: kunzf@musc.edu
=========================================================


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



*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index