Subscribe Bookmark RSS Feed

Rename column heading for multiple JMP files

tejvishnu

Community Trekker

Joined:

Jul 1, 2016

Hello,

I have about more than 200 JMP files in a directory and all of them have the same column headings. I realized that there is a typographical error for one of the column headings and I was wondering if there is a simple way to correct this for each of these 200 files.

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson

Super User

Joined:

Jun 22, 2012

Solution

JMP has a fairly extensive set of functions that allow for file manipulations.  They are well documented with examples at:

     Help==Scripting Index==>Functions==>File

Here is a real simple script that does what you are requesting

Names Default To Here( 1 );
Thefiles = Files In Directory( "C:\Users\txjim\Documents\test files" );
For( i = 1, i <= N Items( TheFiles ), i++,
	dt = Open( "C:\Users\txjim\Documents\test files" || "\" || TheFiles[i] );
	dt:sex << set name( "Gender" );
	Close( dt, save );
);
Jim
2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

Solution

JMP has a fairly extensive set of functions that allow for file manipulations.  They are well documented with examples at:

     Help==Scripting Index==>Functions==>File

Here is a real simple script that does what you are requesting

Names Default To Here( 1 );
Thefiles = Files In Directory( "C:\Users\txjim\Documents\test files" );
For( i = 1, i <= N Items( TheFiles ), i++,
	dt = Open( "C:\Users\txjim\Documents\test files" || "\" || TheFiles[i] );
	dt:sex << set name( "Gender" );
	Close( dt, save );
);
Jim
tejvishnu

Community Trekker

Joined:

Jul 1, 2016

Thanks Jim - this worked like a charm!

Also, thanks for the handy reference.