Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Combining Indicator Columns

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 27, 2015 10:45 AM
(5421 views)

Hello all!

I have created what I believe are referred to as indicator columns. In my study I have two red herring questions to see if respondents are paying attention, not my idea, and I am trying to create a single variable containing...

- Those who answered both correctly
- Those who answered ONE wrong
- Those who answered BOTH wrong

So we have a mutually exclusive set of groups. When I filtered I flagged TRUE with "1" and FALSE with nothing. I did this with all three groups which has left me with 3 columns that mirror the below excluding the last column...

BothCorrect | OneWrong | TwoWrong | What I want |
---|---|---|---|

. | 2 | . | 2 |

1 | . | . | 1 |

. | . | 3 | 3 |

What I am trying to do is combine the first 3 columns into the last at which point I would go in and label what 1, 2 and 3 are.

I tried a formula...

If(:BothCorrect == 1, 1, If(:OneWrong == 2, 2, If(:TwoWrong == 3, 3, "NA")))

That did not work, likely due to syntax.

Could anyone provide some guidance on this, please, with or without the use of a formula?

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

If you have numeric columns and you're just looking for the first non missing value (or if you can assume that only one of the three columns will be non missing), this column formula might do want you need:

If( !Is Missing( :BothCorrect ),

:BothCorrect,

If( !Is Missing( :OneWrong ),

:OneWrong,

If( !Is Missing( :TwoWrong ),

:TwoWrong,

.

)

)

)

Michael Crotty

Sr Statistical Writer

JMP Development

Sr Statistical Writer

JMP Development

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

If you have numeric columns and you're just looking for the first non missing value (or if you can assume that only one of the three columns will be non missing), this column formula might do want you need:

If( !Is Missing( :BothCorrect ),

:BothCorrect,

If( !Is Missing( :OneWrong ),

:OneWrong,

If( !Is Missing( :TwoWrong ),

:TwoWrong,

.

)

)

)

Michael Crotty

Sr Statistical Writer

JMP Development

Sr Statistical Writer

JMP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Combining Indicator Columns

Michael,

Thank you, that did work, but I had to go back into the formula and include the "!" before the "Is missing". What is the "!" doing exactly?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Combining Indicator Columns

The "!" is a shorthand notation in JSL for the Not() function. It negates its argument. So !IsMissing(x) returns 1 if x is not missing and zero if x is missing.

Michael Crotty

Sr Statistical Writer

JMP Development

Sr Statistical Writer

JMP Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Combining Indicator Columns

Thank you!