We’re asking you to select a content label when starting a new topic in the Discussions area. Read more to find out why.
Choose Language Hide Translation Bar
Highlighted
Ainaskid
Level II

I'd like my JMP script to verify col contents are numeric before performing my analysis

Hello Community,

I have a JMP script that's currently up and running. However i've run into specific circumstances where it pukes due to the presence of a string observation in a col where it's expecting a numeric one. 

I'd like my script to check each observation in this column to ensure they are all numeric before attempting to perform the required analysis. If a non-numeric character is found, i'd like to have it deleted. 

This problem stems from the fact that the source files generated from my test equipment populates a string when an error occurs. 

Your help/time is greatly appreciated.

Regards,

Olu.

3 REPLIES 3
Highlighted
uday_guntupalli
Level VIII

Re: I'd like my JMP script to verify col contents are numeric before performing my analysis

Edited after @txnelson's post. I forgot to mention the column data type editing .

 

@Ainaskid
       Hello, I would try the following. Essentially if you know anything that is a string in your column is invalid or error, model the column as numeric and hide or exclude the strings as shown below. 

Clear Globals(); Clear Log(); 

dt = Current Data Table(); 

Col = Column(dt,"Test"); // assuming column "Test"  is the desired column 

Col << Data Type("Numeric) << Set Modeling Type("Continuous");
dt << select Where(IsMissing(:Test)); dt << Hide and Exclude ; // Can also delete


 

Best
Uday
Highlighted
txnelson
Super User

Re: I'd like my JMP script to verify col contents are numeric before performing my analysis

The following will convert the suspect column to a numeric, and when it does this, it will automatically convert any values that can not be converted to numeric to a missing value

Clear Globals(); Clear Log(); 
dt = Current Data Table(); 

 Column(dt,"Test")<<data type(numeric)<<modeling type(continuous);
Jim
Highlighted
Ainaskid
Level II

Re: I'd like my JMP script to verify col contents are numeric before performing my analysis

Thanks for the quick response. I'll try it out shortly and let you know.

Thanks,

Olu.