Statalist


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

Re: st: problem with -return macro-


From   Jeph Herrin <[email protected]>
To   [email protected]
Subject   Re: st: problem with -return macro-
Date   Mon, 25 Jan 2010 13:29:01 -0500

of course. thanks.

Tirthankar Chakravarty wrote:
Try this:
************* test ***************
cap program drop test
program define test, rclass
       version 11
       local rlist
       forv i=1/50 {
               local text "text`i'"
               local rlist `rlist' `text'
       }
       di "`rlist'"
       return local test `"`rlist'"'
end

test
di "`r(test)'"
**********************************

On Mon, Jan 25, 2010 at 10:22 PM, Jeph Herrin <[email protected]> wrote:
I thought I understood this, but maybe I'm just making
an obvious typo. When I run the following

************* test ***************
program define test, rclass
       version 11
       local rlist
       forv i=1/40 {
               local text "text`i'"
               local rlist `rlist' `text'
       }
       di "`rlist'"
       return local test `"`rlist'"'
end

test
di r(test)
**********************************

Why is -rlist- truncated to 244 chars in the return list? I have
tried this a number of different ways (I guess I have never tried
to return a long string before?); I thought as long as I used
macro copy rather than evaluate, macros would not get truncated.
I have tried many variations on the -return- assignment, but this
is the one explicitly recommended on [P] page 340.

thanks,
Jeph






*
*   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/




*
*   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