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

st: Re: Strange rclass program return

From   "Martin Weiss" <>
To   <>
Subject   st: Re: Strange rclass program return
Date   Sun, 5 Apr 2009 11:24:56 +0200


I addition to the solution provided in this thread:

You never want a -program- with a name that is in use in official Stata. If you -which- your name beforehand, you know whether that is the case.

Also note that in this simple case you can use the -return list- left behind by -summarize-. Omitting the -rclass- statement allows you to do that...

program mytest
    drop _all
     set obs 50
    generate x = uniform()
    summarize x, meanonly

----- Original Message ----- From: "Nelson, Carl" <>
To: <>
Sent: Sunday, April 05, 2009 12:11 AM
Subject: st: Strange rclass program return

My previous uses of rclass programs with return statements have behaved as documented. But today, I can not get return to return results from rclass programs. I have tried several examples with the same result. The simplest example follows.

 do test1

. program test, rclass
 1.     drop _all
 2.     quietly: set obs 50
 3.     generate x = uniform()
 4.     summarize x
 5.     return scalar testmean = r(mean)
 6. end

. return list

end of do-file

I am at a loss as to why return is not returning results. I would appreciate suggestions from much more expert Stata users.

Carl Nelson
University of Illinois

*   For searches and help try:

*   For searches and help try:

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