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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Discussions
- :
- Missing value codes and formulas

- 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
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jul 10, 2015 9:55 AM
(4050 views)

When I set a missing value code in a continuous data column, and then write a formula in another column that refers to the first column, the formula includes the missing value code (-9999) in the calculation. For a simple example, I have a column of temperatures in Kelvin that I am converting in the second column to Celsius. Wherever I have a missing value code in the Kelvin column, the calculated value in the new Celsius column is -10,272.15. I would like the second column to also show the missing value code. I would just delete all of the -9999s, but we want to be able to distinguish between data that is missing because we did not collect it, and data that is missing due to instrument malfunctions. What am I doing wrong?

1 ACCEPTED SOLUTION

Accepted Solutions

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

What version of JMP are you using?

We've changed this behavior with JMP 12. Functions in the formula editor now respect the Missing Value Code property. Earlier versions (as you've discovered) didn't do this.

If you want to account for this in your conversion in JMP 11 and earlier you'll need to put a conditional in your formula.

If(:Temp Kelvin == -9999, -9999, :Temp Kelvin - 272.15)

-Jeff

-Jeff

6 REPLIES

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

What version of JMP are you using?

We've changed this behavior with JMP 12. Functions in the formula editor now respect the Missing Value Code property. Earlier versions (as you've discovered) didn't do this.

If you want to account for this in your conversion in JMP 11 and earlier you'll need to put a conditional in your formula.

If(:Temp Kelvin == -9999, -9999, :Temp Kelvin - 272.15)

-Jeff

-Jeff

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

Jul 21, 2015 9:08 AM
(3781 views)
| Posted in reply to message from Jeff_Perkinson 07/13/2015 01:08 PM

Thanks For your answer, Jeff. I am using JMP 11, but I guess my example was too simple to elucidate the real problem. I'm not sure how to write a conditional statement (or statements) that will deal with -9999s when I have 3 columns that I am trying to average. For example, I have 3 columns of soil temperature data, and sometimes one, two, or three of the columns will have -9999s. This programming is beyond my level of understanding. Maybe I should just get JMP 12... Any insight would be appreciated!

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

No need for JMP 12. Here's an example IF statement that averages three columns if none of them are -9999:

if **(**:Temp_Kelvin != -**9999** &

:Temp2_Kelvin != -**9999** &

:Temp3_Kelvin != -**9999**,

** (**:Temp_Kelvin + :Temp2_Kelvin + :Temp3_Kelvin**)** / **3**;

**)**;

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

Thanks PMRoz, but I'm wondering if I can take the average of the two columns that don't have -9999 (if there is one column missing), or just use the value from the one column that has data (if both other values are missing). For example:

Soil temp 1, Soil temp 2, Soil temp 3

287.1, 289.3, 288.6

-9999, 286.6, 287.9

-9999, 287.5, -9999

-9999, -9999, -9999

I want to take the average of all three values in the first line, cols 2 and 3 in the second line, use the value from col 2 in the third line, and return a -9999 for the fourth. Is this possible with conditional statements?

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

This could do it.

**(**match**(**:Temp_Kelvin, -**9999**, **0**, :Temp_Kelvin**)** +

match**(**:Temp2_Kelvin, -**9999**, **0**, :Temp2_Kelvin**)** +

match**(**:Temp3_Kelvin, -**9999**, **0**, :Temp3_Kelvin**)** **)**

/

**(**match**(**:Temp_Kelvin, -**9999**, **0**, **1)** +

match**(**:Temp2_Kelvin, -**9999**, **0**, **1)** +

match**(**:Temp3_Kelvin, -**9999**, **0**, **1)** **)**

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

The **MATCH** function does the trick. From the Scripting guide:

**Match**

You can use the Match() function to make several equality comparisons without needing to rewrite the value to be compared. The syntax is:

Match**(**x, value1, result1, value2, result2, **...**, resultElse**)**

For example, the following script recodes gender abbreviations in **Big Class.jmp**:

For Each Row**(**

sex = Match**(** sex, "F", "Female", "M", "Male", "Unknown" **)**

**)**;