[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 <>
To   stata list <>
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 <> 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 )

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 L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

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