Hello,
This seems like a quite basic question, but I'm likely using the wrong search terms because I haven't found a good answer.
I have a script where initially I was just making a list of strings (file paths) and could use them in sequential order without issue. As the scope expanded, I now need to do filtering based on criteria in two other lists of the same length that were created at the same time. My brain still works in data tables, and in a data table (or SQL) format this would be an easy thing to do. Creating a hidden data table could be a viable option, but I'd like to better understand working with different data structures and changing my code to use another dt seems messy.
This seems like an application for associative arrays, but I'm struggling to correctly create the array and the scripting guide and scripting index hasn't been illuminating. Can someone point me in the right direction or suggest a data structure that would make more sense for what I'm now trying to do? Or would a hidden table actually be the best option?
Also note that in this example I have three individual lists. In my current application each list is contained in its own list where List_A[1] corresponds to List_B[1], etc, but I'm iterating through the parent lists.
Thank you!
Names Default To Here( 1 );
//example data is in dt, my data isn't
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//this is more or less the structure of the data that I have
sex_list = dt:sex << get values;
height_list = dt:height << get values;
weight_list = dt:weight << get values;
//this is what I would do if I had the data in a dt
output = dt:weight[dt << get rows where(and(:age == 13, :sex == "M"))];
show(output);
//how to do this with the data in a structure with no dt? what structure would be appropriate?