Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Creating local from levelsof exceeding 255 characters


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Creating local from levelsof exceeding 255 characters
Date   Fri, 14 Jan 2011 11:26:01 +0000 (GMT)

--- On Fri, 14/1/11, Palan, Stefan wrote:
> However, the truncation problem seems to occur when I use it
> in a foreach statement. What I would like to do is loop over
> all values in my macro, but it stops after 255 characters.

That means that at some point you still evaluated that local.
As long as you do not do so, there will be no problem:

*--------------- begin example -------------------
// create a variable such that a string listing
// all its values is longer than 245 characters
drop _all
set obs 500
gen id = _n

// store that string in locals
levelsof id, local(levs)

// do the loop
foreach lev of local levs {
	di "`lev' " `newl'
}
*--------------- end example ----------------------
(For more on examples I sent to the Statalist see: 
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index