cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Use World Cup data to build models, explore spatial relationships, and create informative visualizations in JMP. Register. July 17, 2 pm US Eastern Time.
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Georgios_Tsim
Level III

Check if a column contains a substring

I would like to create a new column in using jsl based on a condition that involves 2 columns. I could describe in ordinary language it as follows:

 

New Column( "Condition",
        Character,
        "Nominal",
        Formula(
            If(  Column A contains substring "REF" then return Word(4, Column B, "_")
            else return Word(4, Column A, "_")
               )
        )

could you help me with the syntax in the if statement?

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Check if a column contains a substring

 

If(Contains("A_B_C", "B"),
	Word(1, "D_C", "_")
,
	Word(2, "A_Z", "_")
)

is an example using Contains and Word. Replace hard-coded strings with your character column references

 

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Check if a column contains a substring

 

If(Contains("A_B_C", "B"),
	Word(1, "D_C", "_")
,
	Word(2, "A_Z", "_")
)

is an example using Contains and Word. Replace hard-coded strings with your character column references

 

-Jarmo

Recommended Articles