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
- :
- if missing, then fill in with previous value for m...

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

Apr 6, 2013 10:58 AM
(1653 views)

I'm having trouble getting this logic correct and I'm not sure where I'm going wrong. I want to have a script where, if the operator name is row i is the same as the operator name in row (i-1), then if the measurement value in row i is missing, fill it in with the measurement value in row (i-1). I have several measurement values, so I'm searching across columns for any column with "Meas" in the name.

So far, I have the script below, but it just isn't working and I'm not sure why..

(also, I'm new to the forum. How do I get the code to maintain the formatting when I copy it in?)

dt = current data table();

for (j=1, j<= ncols(dt),j++,

colname = Column ( j ) << getname();

If( Contains( colname, "Meas") > 0,

for (i = 2, i <= nrows(dt), i++,

if(Column("OperatorName")* == Column("OperatorName")[i-1],*

if (column(j)* == isMissing(),*

column(j)* = column(j)[i-1]; // set equal to row above*

);

);

);

);

);

1 ACCEPTED SOLUTION

Accepted Solutions

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

Apr 7, 2013 1:43 AM
(2514 views)

Solution

The only error I can find is how Is Missing() is used. Think of it as a function rather than a value.

If**(** Is Missing**(** Column**(** j **)[**i**]** **)**,...

2 REPLIES

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

Apr 7, 2013 1:43 AM
(2515 views)

The only error I can find is how Is Missing() is used. Think of it as a function rather than a value.

If**(** Is Missing**(** Column**(** j **)[**i**]** **)**,...

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

Apr 8, 2013 7:12 AM
(1257 views)