Subscribe Bookmark RSS Feed

JSL - Create new data column by row # specified in lists

terapin

Community Trekker

Joined:

Jun 23, 2011

I'm trying to take some lists I have and create a new data column in which the data from data_list is placed into the rows specified by row_list.  How would I best go about doing this using the example information below?

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

New Column( "X" );

row_list = { 1, 6, 9, 18, 24, 30 };

data_list = { 5, 10, 15, 20, 25, 30 };

1 REPLY
pmroz

Super User

Joined:

Jun 23, 2011

Just loop over your lists:

Names Default To Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

New Column( "X" );

row_list = { 1, 6, 9, 18, 24, 30 };

data_list = { 5, 10, 15, 20, 25, 30 };

for (i = 1, i <= nitems(row_list), i++,

    one_row = row_list[i];

    column(dt, "X")[one_row] = data_list[i];

);