Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: subinstr extended macro function limit


From   Matthew White <mwhite@poverty-action.org>
To   statalist@hsphsun2.harvard.edu
Subject   st: subinstr extended macro function limit
Date   Tue, 18 Sep 2012 11:24:59 -0400

Hi all,

Using Stata 11.2 SE, I'm having trouble with the -:subinstr- extended
macro function. I'm running this line of code:

local order : subinstr local notdummies " `before' " " `before' `dummies' "

Which expands to:

- local order : subinstr local notdummies " `before' " " `before' `dummies' "
= local order : subinstr local notdummies " k07_locationcompe " "
k07_locationcompe k08_compeac
> tions_Same_p_s_at_low k08_compeactions_Lower_quality_p k08_compeactions_Offer_better_qu k08_c
> ompeactions_Offer_diff_or_m k08_compeactions_Provide_faster_ k08_compeactions_More_establishe
>  k08_compeactions_Better_more_loc k08_compeactions_Better_reputati k08_compeactions_Better_cu
> stomer k08_compeactions_Have_more_asset k08_compeactions_Offer_discounts k08_compeactions_Lar
> ger_advertis k08_compeactions_Better_terms_of k08_compeactions_Unethical_illeg k08_compeactio
> ns_Other k08_compeactions_None "

I get a "varlist not allowed" error message with return code 101.
Here's a simplified example that gives me the same error:

local x1 x
mata: st_local("x1000", 1000 * "x")
local x2 : subinstr local x1 "x" "`x1000'"

It looks like a -:subinstr- limit, though less than 1000 characters
seems to be a low limit for an extended macro function. Mata works
fine:

mata: st_local("x2", subinstr(st_local("x1"), "x", "`x1000'", 1))

Any thoughts would be appreciated.

Thanks,
Matt

-- 
Matthew White
Senior Project Associate
Innovations for Poverty Action
101 Whitney Avenue, New Haven, CT 06510 USA
+1 434-305-9861
www.poverty-action.org
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index