cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

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

Concatenate data table from subset

Hi all,

I have to subset a data table and concatenate the data tables one by one into another file.

How can I concatenate the data tables from the subset table to the original table? please help, im really not sure how to do it

 

Here's my sample data: 

 

Data Table( "Analgesics" ) << Subset(
    Output Table( "dt_subset" ),
    By( :gender ),
    All rows,
    Selected columns only( 0 ),
    columns( :drug, :pain )
);

// concatenating to my original data table
For( i = 1, i <= 10, i++, //not sure on this one
    dt << concatenate( dt_subset( i ), Append to First Table( 1 ) )
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Concatenate data table from subset

Get reference of the subset and then use that for looping.

 

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

dt_subset = dt << Subset(
	Output Table("Subset_of_analgesics"),
	By(:gender),
	All rows,
	Selected columns only(0),
	columns(:drug, :pain)
);
Show(dt_subset);

//dt_subset is a list, use N items to get items in the list
For(i = 1, i <= N Items(dt_subset), i++,
	dt << Concatenate(dt_subset[i], Append To first table(1));
);
-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Concatenate data table from subset

Get reference of the subset and then use that for looping.

 

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

dt_subset = dt << Subset(
	Output Table("Subset_of_analgesics"),
	By(:gender),
	All rows,
	Selected columns only(0),
	columns(:drug, :pain)
);
Show(dt_subset);

//dt_subset is a list, use N items to get items in the list
For(i = 1, i <= N Items(dt_subset), i++,
	dt << Concatenate(dt_subset[i], Append To first table(1));
);
-Jarmo

Recommended Articles