cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
lilysecret
Level III

"Get Value Labels" syntax help

Hello,

 

I am developing a script that will loop through the columns in my data tables, and will apply a supercategory based on a certain set of value labels. (Value Labels({0 = "Poor", 25 = "Fair", 50 = "Good", 75 = "Very good", 100 = "Excellent"}))

 

I need help getting the syntax right in my non-working code below. I've attached some test data as well. Thanks in advance.

 

 

 
Names Default To Here( 1 );

// Specify the column name
columnName = "36/5. Considering everything about the brand you use most often, how would you rate it overall?";

// Get the column reference
col = Column(columnName);

//test to see if the value labels contain 100 = "Excellent" and if so, apply a supercategory
if (Get Value Labels(col)["100"] == "Excellent",
	col << Set Property( "Supercategories", {Group( "Top 2", {75,100} ), Group( "Bottom 2", {25,0} )}));
 
 
1 ACCEPTED SOLUTION

Accepted Solutions

Re: "Get Value Labels" syntax help

Someone else might have a more elegant solution, but the example below works:

Names Default To Here( 1 );

// Specify the column name
columnName = "36/5. Considering everything about the brand you use most often, how would you rate it overall?";

// Get the column reference
col = Column(columnName);

//test to see if the value labels contain 100 = "Excellent" and if so, apply a supercategory
lst =  char(col << Get Value Labels); //get col properties as string
if(contains (lst, "100 = \!"Excellent\!""), //see if 100 = "Excellent" is in the string
	col << Set Property( "Supercategories", {Group( "Top 2", {75,100} ), Group( "Bottom 2", {25,0} )});
	
);

View solution in original post

2 REPLIES 2

Re: "Get Value Labels" syntax help

Someone else might have a more elegant solution, but the example below works:

Names Default To Here( 1 );

// Specify the column name
columnName = "36/5. Considering everything about the brand you use most often, how would you rate it overall?";

// Get the column reference
col = Column(columnName);

//test to see if the value labels contain 100 = "Excellent" and if so, apply a supercategory
lst =  char(col << Get Value Labels); //get col properties as string
if(contains (lst, "100 = \!"Excellent\!""), //see if 100 = "Excellent" is in the string
	col << Set Property( "Supercategories", {Group( "Top 2", {75,100} ), Group( "Bottom 2", {25,0} )});
	
);
lilysecret
Level III

Re: "Get Value Labels" syntax help

Yes, thank you, this should do nicely!

Recommended Articles