Statalist


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

st: Maximum length of a string expression in a program


From   Davide Cantoni <[email protected]>
To   [email protected]
Subject   st: Maximum length of a string expression in a program
Date   Mon, 16 Mar 2009 00:00:48 -0400

Dear statalisters,

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.
Specifically, my code looks like this

*** begin code

program mycommand
	syntax namelist [if] [in] [aweight fweight pweight], ...
	
	gettoken command 0 : namelist
	gettoken depvar regressors : 0

	`command' `depvar' `regressors' `if'  [`weight' `exp'], ...

	...

end

*** end code

(to explain: the idea is to have a two-word command, where the second
word is a regression command built-in in Stata. So, for example, one
would run "mycommand areg y x1 x2 x3..." and then -mycommand- would
use -areg- within its routine)

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, which of course can create
problems. What would a savvy programmer to do avoid this problem? I
cannot imagine that any list of regressors has to be shorter than 244.

Thanks for your help and suggestions,

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