Statalist


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

st: strange behavior of booleanfunctions in dialog if expressions


From   "Zurab Sajaia" <[email protected]>
To   "statalist" <[email protected]>
Subject   st: strange behavior of booleanfunctions in dialog if expressions
Date   Wed, 2 Apr 2008 16:31:25 -0400

Dear all,

I have encountered this problem in both Stata version 9.2 and 10 and not sure whether I'm doing something wrong or it's indeed strange.

The setup is as follows:
I have a (numeric) parameter entered by a user and before executing need to check it's values to be in some range... so something like this example:

VERSION 9

POSITION . . 300 300

DIALOG main
BEGIN
EDIT ed_ed1 30 44 170 ., label("input") numonly
BUTTON bt_bt1 30 100 100 ., label ("button") onpush(program action)
END

PROGRAM action
BEGIN
if main.ed_ed1.isle("0") {
stopbox note "true"
exit
}
stopbox note "false"
END

I have here -isle- function but same happens with -islt-, -isgt-, and -isge- as well. The problem arises with numbers (-1, 1), if I put them with leading 0 (like 0.9 or -0.3) everything looks fine but if I put .9 or -.3 instead then -islt- and -isle- give wrong answer for positive fractions and -isgt- and -isge- make mistakes with negatives.

Does anyone have experienced something similar?

any thoughts would be appreciated.
Zurab


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