The World Statistics Day celebration continues here in the Community. We all need reliable data for sound decision making. Do you have a data source that you trust most? Head over to Discussions to tell us about it.
Choose Language Hide Translation Bar
Highlighted
Level III

Variable Level Ranges in Formulas

I am trying to use a range of levels from a source variable in a formula and encountering some challenges.

For example in TestVar I would have a response scale such as...

1. Poor
2. Fair
3. Good
4. Very good
5. Excellent

I want to use something like IF (TestVar == 1-3, "Rejector", "Acceptor")

"1-3" is treated as an equation which is not what I am looking for. Delimiting does not work either. I did get around this by simply recoding TestVar but I am thinking there has to be a way to use a range. I did consider an Or statement but I am curious if there is a way to use a range.

As always, thanks for the help!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User

Re: Variable Level Ranges in Formulas

if (1 <= TestVar <= 3, "Rejector", "Acceptor")

4 REPLIES 4
Highlighted
Super User

Re: Variable Level Ranges in Formulas

if (1 <= TestVar <= 3, "Rejector", "Acceptor")

Highlighted
Level III

Re: Variable Level Ranges in Formulas

Thank you! That works perfectly and I would have never landed on that formatting for the parameter. Is there some documentation I can review within JMP or online that lays out that sort of logic for different scenarios?

Highlighted
Super User

Re: Variable Level Ranges in Formulas

I found it in the scripting guide just the other day.  In chapter 5 under operators.  Look at table 5.3.

<=, <     Less Equal Less      a<=b<c   Less Equal Less(a,b,c)      Range check. Return 1 if true, 0 if false. Missing values in either a or b propagate missing values.

Highlighted
Level III

Re: Variable Level Ranges in Formulas

That is fantastic. Thank you!

Article Labels

There are no labels assigned to this post.