cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Feli
Level IV

Import with decimal separator comma in JMP 16 - Custom Locale Settings not working

I have to import some text files where comma (,) is used as decimal separator. I don't want to change my settings from English/Use JMP Settings since otherwise my other imports and scripts stop working, so I thought I'd try the new feature in JMP 16.1 (JSL command to Get and Set the Display Language in JMP ) that @Jeff_Perkinson mentioned.

So off I go building my little script :

Get Preferences( Custom Locale Settings );
    Preferences( Custom Locale Settings( Decimal Separator(",") ) );
Open(
	"myfile",
	columns(
		...
	),
	Import Settings(
		End Of Line( CRLF, CR, LF ),
		End Of Field( Other( "0x3b" ), CSV( 0 ) ),
		Strip Quotes( 1 ),
		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( 0 ),
		Column Names Start( 1 ),
		Data Starts( 1 ),
		Lines To Read( "All" ),
		Year Rule( "20xx" )
	)
);

But nothing happens- the comma doesn't get recognized as decimal separator and the numeric columns are imported as a character column, which is exactly not what I wanted.

So any help? Is there something wrong in my import settings (I didn't change any standard preferences except that I use semicolon as end of field separator) or did I find a bug?

My JMP version is 16.1 and I use the Windows version, if that helps.

1 ACCEPTED SOLUTION

Accepted Solutions
Feli
Level IV

Re: Import with decimal separator comma in JMP 16 - Custom Locale Settings not working

After talking with JMP support, we found this solution: 

Preferences( Custom Locale Settings( Decimal Separator(",") ) );
Open(
    "/C:/Temp/test_import.csv",
    columns(
        New Column("Number", Numeric, "Continuous", Format("Best", 12)),
        New Column("Number2", Numeric, "Continuous")
    ),
    Import Settings(
        End Of Line(CRLF, CR, LF),
        End Of Field(Other(";"), CSV(0)),
        Strip Quotes(1),
        Use Apostrophe as Quotation Mark(0),
        Use Regional Settings(1),
        Scan Whole File(1),
        Treat empty columns as numeric(0),
        CompressNumericColumns(0),
        CompressCharacterColumns(0),
        CompressAllowListCheck(0),
        Labels(1),
        Column Names Start(1),
        Data Starts(2),
        Lines To Read("All"),
        Year Rule("20xx")
    )
)

The key is to set Use Regional Settings(1) and set the columns to numeric during import.

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Import with decimal separator comma in JMP 16 - Custom Locale Settings not working

This could be a bug (you could contact support@jmp.com), but could you script your way out of this temporarily? You could for example replace the "," with "." in specific columns and then attempt to convert the columns to Numeric.

-Jarmo
Lu
Lu
Level IV

Re: Import with decimal separator comma in JMP 16 - Custom Locale Settings not working

Hello Feli

I think the fasted way to solve your problem is to use the recode function. Go to the column heading, right click and activate "recode", Then go to the red triangle "convert to Character" again go to the red triangle "replace string" and change the string into what you want. Afterwards you can change the column charactersitic back numerical. 

Hope this is of help?

 

regards

 

Lu

Feli
Level IV

Re: Import with decimal separator comma in JMP 16 - Custom Locale Settings not working

Seems that I found a bug - yes, recode or scripting can resolve it, but I wanted to try it in a clever way...

Feli
Level IV

Re: Import with decimal separator comma in JMP 16 - Custom Locale Settings not working

After talking with JMP support, we found this solution: 

Preferences( Custom Locale Settings( Decimal Separator(",") ) );
Open(
    "/C:/Temp/test_import.csv",
    columns(
        New Column("Number", Numeric, "Continuous", Format("Best", 12)),
        New Column("Number2", Numeric, "Continuous")
    ),
    Import Settings(
        End Of Line(CRLF, CR, LF),
        End Of Field(Other(";"), CSV(0)),
        Strip Quotes(1),
        Use Apostrophe as Quotation Mark(0),
        Use Regional Settings(1),
        Scan Whole File(1),
        Treat empty columns as numeric(0),
        CompressNumericColumns(0),
        CompressCharacterColumns(0),
        CompressAllowListCheck(0),
        Labels(1),
        Column Names Start(1),
        Data Starts(2),
        Lines To Read("All"),
        Year Rule("20xx")
    )
)

The key is to set Use Regional Settings(1) and set the columns to numeric during import.