cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
BHarris
Level VI

Standardizing attributes by column name

I tend to work with the same types of data every day.  Every time I load a file, JMP sets some columns as "Continuous" that really work better as nominals.

 

Is there a way to tell JMP that if it sees a column with a specific name, e.g. "case_id", that it should always flag it as nominal?

 

I know scripts can do this, but having to run a script every time I open a file has gotten a bit tedious.

3 REPLIES 3
WebDesignesCrow
Super User

Re: Standardizing attributes by column name

Hi @BHarris ,

 

During import, you can right click the column to define is as nominal. But, I guess you want to automate that without the need to re-defined it again every time you open the working file.

I think if you can convert the script to an "add-in", it is possible to tell JMP that if they see a column with specific name, always define it as nominal whenever you open the file.

WebDesignesCrow_0-1712107566004.png

Question though;

- the files that you open is not in standardized "column" / "header" position?

- or is it any data file, but the column "case_id" would be consistently present?

 

BHarris
Level VI

Re: Standardizing attributes by column name

Yes, these are .tsv files that have a "case_id" column -- not guaranteed to be in the same column from file to file.

 

Can add-ins be programmed to run every time a file is opened?

WebDesignesCrow
Super User

Re: Standardizing attributes by column name

Rather than use default Open file function, you just open the file through add-in.

 

I've tested simple script like below to convert "case_id" to nominal, for 2 TSV files inside 1 folder.

Pls mind the path that I set is "Documents/TSV".

You can change the path for testing at your PC.

If all good, then you can convert this JSL script to add-in (refer to https://community.jmp.com/t5/Learning-Center/Add-In-Builder/ta-p/276711 )

 

Hope it helps.

//Open  Table to pick file
Names Default To Here( 1 );
file = Pick File(
	"Select the TSV file to input",
	"$DOCUMENTS/TSV",
	{"All Files|*"},
	1,
	0
);
If( file != "",
	dt1 = Open(
		file,
		Import Settings(
		End Of Line( CRLF, CR, LF ),
		End Of Field( Tab, CSV( 0 ) ),
		Strip Quotes( 0 ),
		Use Apostrophe as Quotation Mark( 0 ),
		Use Regional Settings( 0 ),
		Scan Whole File( 1 ),
		Treat empty columns as numeric( 0 ),
		CompressNumericColumns( 0 ),
		CompressCharacterColumns( 0 ),
		CompressAllowListCheck( 0 ),
		Labels( 1 ),
		Column Names Start( 1 ),
		First Named Column( 1 ),
		Data Starts( 2 ),
		Lines To Read( "All" ),
		Year Rule( "20xx" )
		)
	)
);

//Standardize "case_ID" to character nominal
Names Default To Here( 1 );
dt1 :case_id << Data Type( Character ) <<
Set Modeling Type( "Nominal" );