Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: odd behavior in ado file


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: odd behavior in ado file
Date   Fri, 22 Jul 2005 08:37:56 -0500

The 8th line should be:
	local f = (`y' - 1)/ln(`y')
				     ^^^

Scott
	
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Katsuhide Isa
> Sent: Friday, July 22, 2005 8:11 AM
> To: Statalist
> Subject: st: odd behavior in ado file
> 
> Dear Statalisters,
> 
> I wrote the following simple ado file.
> 
> /*----------myboxcox.ado----------*/
> program define myboxcox
> version 7
> local y = exp(`1')
> if `y' == 1 {
>    di in gr "f = " 1
>    }
> else {
>    local f = (`y' - 1)/ln(`1')
>    di in gr "f = " "`f'"
>    }
> end
> /*----------myboxcox.ado----------*/
> 
> It works well all in all. But it sometimes shows an odd
> behavior.
> More specifically, when typed - myboxcox 1 - (namely, setting
> the argument as 1), the result is ". "(missing?), not 1.7182818
> (=(exp(1) - 1)/ln(exp(1))).
> 
> When directly typed in the command line as
> - di (exp(1) - 1)/ln(exp(1)) -, the result is 1.7182818,
> which is just as it should be.
> 
> I don't see why such a phenomenon occurs.
> 
> Any suggestions welcome.
> Thanks in advance.
> 
> K.I.
> *
> *   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/


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



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