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
AshrafFathy
Level I

Modifying Column names

Hi, I have the column header very long after I extract from STDF data file.

Here is the format I have 

 

TestName.....  <> Test Name2....

How can I make the column header only have the Test Name2....  and remove every thing else without having to export and import from Excel.

Thanks.

8 REPLIES 8
txnelson
Super User

Re: Modifying Column names

Is there a standard delimiter that separates TestName from Test Name2?  If not a delimiter, is there a standard structure for TestName?

Jim
AshrafFathy
Level I

Re: Modifying Column names

The only standard delimiter is  <> . Also, the number of characters in the test name and test name 2 are different.

txnelson
Super User

Re: Modifying Column names

Here is an example of how to change the name to the second name in the test name

names default to here(1);
dt=New Table( "Example",
	Add Rows( 0 ),
	New Column( "thisisatestname00001abc<>andthesecondname<>andmoreinfo",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Selected,
		Set Values( [] )
	)
);

wait(5);

column(1)<<set name(word(2,column(1)<<get name,"<>"))
Jim
AshrafFathy
Level I

Re: Modifying Column names

Thanks but that did not work for some reason.

I opted out to export and import back from Excel after fixing the tables headers.

It is just hard to understand why JMP have no such simple capability compared to excel which does it in a couple of clicks.

 

Ashraf

txnelson
Super User

Re: Modifying Column names

Provide me with a real example and I will see what the issue is.

Jim
jthi
Super User

Re: Modifying Column names

JMP does offer you with Recode Column Names

jthi_0-1695706566199.png

and Extract Segment could be something which works here

jthi_1-1695706600402.png

jthi_2-1695706632905.png

 

-Jarmo
AshrafFathy
Level I

Re: Modifying Column names

Thanks. I tried the Recode already several time and the extract segment and that did not work either.

It seems because the number of characters before and after the <> symbol varies from one test name to another, I end up with some test names segmented and other not fro some reason.

Ashraf

txnelson
Super User

Re: Modifying Column names

Here is another attempt in finding a solution for you.  The script first creates a sample data table, then it adds a new column that takes the second element from the original test name.

txnelson_0-1695754324106.png

names default to here(1);
dt=new table("example",
	new column( "TestName", Character),
	add rows( 100 )
);

// Create sample data
characterPool = "kj;adoilkz;vclkeiop8uyhvjnbuiaedriuna;lkdalkiouie;lkakjfloauifadkjfbvsa;ihdiekd";
for each row(
	:Test Name = "";
	For( i=1, i<=floor(random uniform(2,4)), i++,
		:TestName = :testName || substr(characterPool,floor(random uniform(1,length(characterPool)-1))) ||"<>";
		if(i>2,show(row()))
));


// Create a new column with only the 2nd element of the Test Names
dt << new column("Short Test Name", character,
	formula(word(2,:Test Name,"<>") )
)

 

Jim