BookmarkSubscribe
Choose Language Hide Translation Bar
Highlighted
ptnguyen
Community Trekker

using variable in conditional formula to create new data column

data table(dtname)<<New Column( "PassFail",

    Character, Nominal,

    Formula( If( 0 < AColumnName< 100, "pass", "fail" ) ),

    Lock( 1 )

);

In the script message above; is there a way to replace the constant limits (0 and 100) with variables that have pre-assigned values?

0 Kudos
1 REPLY 1
pmroz
Super User

Re: using variable in conditional formula to create new data column

Yes.  You will need to preface the variable names with "::" so the column formula can see the values.  For example:

lower_limit = 0;

upper_limit = 100;

data table(dtname) << New Column( "PassFail",

    Character, Nominal,

    Formula( If( ::lower_limit < AColumnName < ::upper_limit, "pass", "fail" ) ),

    Lock( 1 )

);

0 Kudos