--- On Mon, 16/3/09, Davide Cantoni wrote:
> I have a question related to programming a new program/ado
> file. I am encountering the problem that one of the
> arguments of my program might be too long as a string,
> going beyond the limit of 244 characters.
<snip>
> I am encountering problems when running -mycommand- with a
> list of regressors that is longer than 244 characters.
> Then, the list is arbitrarily truncated after that limit.
You have to be a bit careful not to evaluate the local
containing such a long string (i.e. avoid using the "=" when
defining a local), but otherwise there should not be a
problem with -gettoken- or the extended macro functions (I
always type -help macro- and follow the link to the helpfile
for the extended macro functions), even if the local surpasses
the 244 tokens limit. This is illustrated in the example
below:
*------------ begin example -------------------
forvalues i = 1/60 {
local lstring "`lstring' very"
}
local lstring "`lstring' long string"
// the string has more than 244 characters:
di `: length local lstring'
// -gettoken- works:
gettoken first rest : lstring
di `:length local first'
di `:length local rest'
*------------- end example --------------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
Hope this helps,
Maarten
-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
*
* 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/