program drop _all
program klm, rclass
version 10
forv i=1/100 {
	local cr "`cr' locum ipsem `i'"
}
return local cer "`cr'"
end
klm
local test "`r(cer)'"
local len: length local test
di "`len'"
works fine for me, returns 1492  (Stata 10.0/MP2, Mac OS X)
Kit Baum, Boston College Economics and DIW Berlin
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.html
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/