Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
eugene077
Level I

combining nominal columns using formula

Hello, I'm trying to aggregate data from 3 columns (coded as "nominal" yes/no) into a new nominal column using "OR" function, but keep getting an error when I put in 

Alcohol abuse==1 | alcohol binging==1 | alcohol withdrawal==1

(See example below)

My goal is to have the new column report a "1" if a subject has ANY alcohol-related history, i.e. has a "1" in any of the preceding columns.

I have also tried 

If(:Alcohol Abuse == 1 | :Alcohol dependence == 1 | :Alcohol withdrawal syndrome == 1, 1, 0)

but no luck - it returns all zeros...

 

Thank you

 

Alcohol abuse alcohol binging alcohol withdrawal any alcohol related problems
1 1 0 1
0 0 0 0
0 0 0 0
1 0 0 1
0 0 1 1
1 REPLY 1
Highlighted
txnelson
Super User

Re: combining nominal columns using formula

It appears that not only are your columns Nominal, but their Data Type is Character.  So for your formula to work, you either need to change the columns to be Numeric, or to reference the values you are attempting to compare using literal references.  See below:

If( :Alcohol Abuse == "1" | :Alcohol dependence == "1" | :Alcohol withdrawal syndrome == "1",
	"1",
	"0"
)
Jim
Article Labels

    There are no labels assigned to this post.