Subscribe Bookmark RSS Feed

using variable in conditional formula to create new data column

ptnguyen

Community Trekker

Joined:

Oct 7, 2011

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?

1 REPLY
pmroz

Super User

Joined:

Jun 23, 2011

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 )

);