[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: SV: re: how do I get more than 244 characters...

From   "Kim Lyngby Mikkelsen (KLM)" <>
To   <>
Subject   st: SV: re: how do I get more than 244 characters...
Date   Thu, 22 Nov 2007 23:31:00 +0100

Thanks to Kit Baum

Although I do not really understand the solution, my problem was not that the returned local r(lg) did not contain all the contents it was supposed to hold, but that my code afterwards to display the contents of r(lg) was wrong.

After my programme had completed, to tried to display the contents of the returned macro r(lg), I wrongly coded:
	di r(lg) 	/* and that only displayed the first 244 characters
whereas using Kit Baums code:
	di "`r(lg)'" 
the complete contents of r(lg) is displayed.

Thanks again.


-----Oprindelig meddelelse-----
Fra: [] På vegne af Kit Baum
Sendt: 22. november 2007 22:24
Emne: st: re: how do I get more than 244 characters...

program drop _all
program klm, rclass
version 10
forv i=1/100 {
	local cr "`cr' locum ipsem `i'"
return local cer "`cr'"

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
An Introduction to Modern Econometrics Using Stata:


In the Stata 10 Programming manual, under 'return' it says:

Be careful with this syntax: do not code
	return local name = `mymacro'
because that will copy just the first 244 characters of `mymacro'. Instead, 
	return local name `"`mymacro'"'

I have tried either way, but I am not able to copy more than 244 characters 
into my returned local macro.

Am I doing something wrong, or is there a workaround this limitation? (I am using Stata/SE 10 for Windows).

A part of my code is given below. ___________________________________________________________________________
*! 1.0.0 KLM 18 Nov 2007
program define longgraph, rclass
	version 10
my code
twoway `cr'
return local lg `"`cr'"'

end ____________________________________________________________________________

The ´cr' is build up through a series of foreach loops, and at the end of 
the loops, `cr' could contain more than 1000 characters.

Regards Kim

*   For searches and help try:

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