Statalist


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

Re: st: Maximum length of a string expression in a program


From   Maarten buis <[email protected]>
To   stata list <[email protected]>
Subject   Re: st: Maximum length of a string expression in a program
Date   Mon, 16 Mar 2009 15:24:34 +0000 (GMT)

--- On Mon, 16/3/09, Davide Cantoni <[email protected]> wrote:
> Regarding your suggestion, Maarten: I think I understand it,
> but it is doing exactly the opposite of what I want: it is
> keeping regressor ``k'', not eliminating it, as I try to do
> in the code above. 

You can do that with the extended macro functions, like in the 
example below:

*--------------- begin example -------------
sysuse auto, clear
local regressors "price mpg foreign"
tokenize `regressors'
local nk : word count `regressors' 
forvalues k = 1/`nk' {
	local foo : list regressors - `k'
	di "`foo'"
}
*-------------- 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 )

Bottom line: you are now comming at a point where you
really need to look into all the wonderful things you
can do with the extended macro functions. You can read
about those by typing: -help extended_fcn- and in 
particular -help macrolists-

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index