cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
UserID16644
Level V

unrecognized as table argument in access For loop

I am trying to concatenate my subset tables, but I kept getting this error:
unrecognized as table argument in access or evaluation of 'dtSubsetList [ /*###*/i]' , dtSubsetList [/*###*/i]

Im using JMP 16

 

names default to here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dtSubsetList = dt << Subset(
	By( :sex ),
	All rows,
	Selected columns only( 0 ),
	columns( :name, :age, :height, :weight )
);

dtNew = New Table( "New Table" );
 
For(i = 1, i <= N Items(dtSubsetList ), i++, 
dtNew << Concatenate(dtSubsetList[i], Append to first table(1)); 
);

 

 

1 REPLY 1
txnelson
Super User

Re: unrecognized as table argument in access For loop

I am unable to replicate the issue.  Your script runs properly without error.

I suggest that you exit JMP, and then reopen it and then run the script.  Your dt_Test is obviously not in the JSL you provided, and is probably an artifact of all of the trial and errors you have attempted.

I will also suggest a change to your code.  The Concatenate platform has the ability to concatenate more than one table in a single execution.  Therefore you can actually past the complete list of data table to the Concatenation rather than having to loop through each one separatly.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dtSubsetList = dt << Subset(
	By( :sex ),
	All rows,
	Selected columns only( 0 ),
	columns( :name, :age, :height, :weight )
);

dtNew = New Table( "New Table" );
 
/*For( i = 1, i <= N Items( dtSubsetList ), i++,
	dtNew << Concatenate( dtSubsetList[i], Append to first table( 1 ) )
);*/

dtNew << Concatenate( dtSubsetList, Append to first table( 1 ) );
Jim