cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

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

Trying to access data values from a column one-by-one

Summarize(dt, IDs = by(:ID)); //this finds all the unique IDs in the data file, which we will need
For (i=0, i<=N Items(IDs), i++,
    ID = donorIDs[i];
);

the above doesn't work, and throws a

 

Subscript problem in access or evaluation of 'IDs[i]' , IDs[/*###*/i]

error.

 

I guess this gets down to some of the fundamentals about how JMP is different from languages like Python and Java, where indexing is common, and instead data are handled in a way that is intended for analysis, display, and manipulation rather than access, or something like that? Sorry if I don't make sense, I'm just trying to make sense of this issue.

 

What data type is IDs at this point in time? A column? Is column a data type? Is this listed in the Scripting Index? I've looked there multiple times by now, maybe I just missed it? As someone with computer experience, it is very convenient to think in data and object types and I don't know how to deal with stuff in JMP that is so ambiguous.

 

So I guess the bottom line is, how do you perform an element-wise operation over a column in general?

1 REPLY 1
txnelson
Super User

Re: Trying to access data values from a column one-by-one

Summarize(dt, IDs = by(:ID));

The Summarize() function returns JMP Lists.  Therefore, IDs returns the unique values of the column ID from the data table referenced by the variable dt.

Proper referencing would be:

IDs[index value]

Therefore, referencing it in a For Loop would be:

For( i = 1, i <= N Items( IDs ), i++,
     variableX = IDs[i];
);

I did not use the variable name of ID as you used in your example.  While ID would be a fine name, it might be confusing, since you have a column of the same name in the data table referenced by variable dt.

Jim

Recommended Articles