Friday, March 16, 2007
Tip of the Day: Using New CHKVAR Function in R:BASE
Supported Versions:
. R:BASE 7.6 for Windows (Build: 7.6.1.30316 or higher)
. R:BASE C/S:I 7.6 for Windows (Build: 7.6.1.30316 or higher)
. R:BASE Turbo V-8 for Windows (Build: 8.0.15.30316 or higher)
Have you ever had a need to find out whether a required VARIABLE
is declared before you use that dotted variable in expressions or
a routine that will not break or result in a sequence of -ERROR-
messages?
Now you can avoid those embarrassing moments by simply verifying
the existence of a variable using new CHKVAR function.
Here's how:
SET VARIABLE vCheckVar = (CHKVAR('varname'))
CHKVAR function checks to see if a variable name exists. The
function returns an integer value of 1 if the variable name
exists or is declared, and 0 if it is not found or declared.
The variable vCheckVar will return a value of 1 or 0.
No more workarounds, suppressing error messages or even lengthy
code to evaluate the existence of a variable.
Have fun!
Very Best R:egards,
Razzak.