cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
aliegner1
Level IV

SPLIT from tall to wide: how to group the resulting columns dynamically?

So I've got a large dt that I'm splitting from TALL to WIDE. This results in a huge qty of columns, all with the header format = "Step#_Parameter_Function".

The amount of these columns vary and are never predictable and set, nor are the step #'s or names.

 

How would i be able to then group these columns by Step#? Some sort of loop to scan through the long list of columns, pick out the first Step# and then assign it to a group labeled that "Step#"?

 

 

<< Split(
       Split By( :recipe_step_id, :parameter_name, :aggregate_function ),
       Split( :value ),
       Group( :recipe, :equipment_id, :chamber_id, :wafer_scribe, :wafer_process_start_time ),
       Output Table( "Wide" ),
       Remaining Columns( Drop All ),
       Sort by Column Property
);

aliegner1_0-1624651417165.png

 

aliegner1_1-1624651446037.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: SPLIT from tall to wide: how to group the resulting columns dynamically?

Here is a simple script that creates a new group of columns that begin with the characters "NPN"

txnelson_0-1624666509566.png

names default to here(1);
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

colNamesList = dt << get column names(string, continuous);

NPNList = {};

for(i=1,i<=nitems(colNamesList),i++,
	If(contains(colNamesList[i],"NPN")==1,
		insert into(NpNList,colNamesList[i])
	)
);
dt << group columns("NPNGroup", NPNList);

 

Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: SPLIT from tall to wide: how to group the resulting columns dynamically?

Here is a simple script that creates a new group of columns that begin with the characters "NPN"

txnelson_0-1624666509566.png

names default to here(1);
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

colNamesList = dt << get column names(string, continuous);

NPNList = {};

for(i=1,i<=nitems(colNamesList),i++,
	If(contains(colNamesList[i],"NPN")==1,
		insert into(NpNList,colNamesList[i])
	)
);
dt << group columns("NPNGroup", NPNList);

 

Jim
aliegner1
Level IV

Re: SPLIT from tall to wide: how to group the resulting columns dynamically?

amazing. One final question. Is it possible to feed it a list of Character String Groups to run through, looking for those columns that match, then putting them in their respective groups?

 

like a list of:

columns that start with "AAA", "BBB","CCC",etc

and then put them in groups labeled AAA, BBB, CCC

 

?

 

how to error skip if there are no columns matching BBB?

txnelson
Super User

Re: SPLIT from tall to wide: how to group the resulting columns dynamically?

  1. Please take the time to read the Scripting Guide found in the JMP Documentation Library under the Help pull down menu.  It will give you the language structures you can use to solve problems such as the one you currently asked about.
  2. Below is a simple example script that creates groups of columns it finds.  Please note, intentionally, there are no columns that begin with XYZ, even though the script checks for it
Names Default To Here( 1 );
// Open Data Table: semiconductor capability.jmp
// → Data Table( "semiconductor capability" )
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );

colNameList = dt << get column names( string );

NPNList = {};
PNPList = {};
XYZList = {};

// Find matching column names
For( i = 1, i <= N Items( colNameList ), i++,
	If(
		Left( colNameList[i], 3 ) == "NPN",
			Insert Into( NPNList, colNameList[i] ),
		Left( colNameList[i], 3 ) == "PNP",
			Insert Into( PNPList, colNameList[i] ),
		Left( colNameList[i], 3 ) == "XYZ",
			Insert Into( XYZList, colNameList[i] )
	)
);

// If groups of columns are found, creat JMP groupings
If( N Items( NPNList ) > 0,
	dt << select columns( NPNList );
	dt << group columns();
);
If( N Items( PNPList ) > 0,
	dt << select columns( PNPList );
	dt << group columns();
);
If( N Items( XYZList ) > 0,
	dt << select columns( XYZList );
	dt << group columns();
);
Jim