Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar
Highlighted
ALopez
Level III

With JSL what is the correct syntax to set the Column property "Reverse"

Hi,

I need to set the properties of a Column to 1) Row Order levels and 2) Reverse.
So far I can do the first one without any problems.

 dt:ColXYZ <<Set Property ( "Row Order Levels", 1 );

However I cannot find anywhere what is the correct syntax to emulate the GUI button "Reverse"

 

Screenshot 2020-10-15 161608.jpg

I have tried several ways but none have worked.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
David_Burnham
Super User

Re: With JSL what is the correct syntax to set the Column property "Reverse"

Just to be clear, are you talking about Row Order Levels, or Value Ordering?

 

Row Order Levels I think just takes a flag - your screenshot looks more like value ordering, and that takes a list e.g. 

 

<< Set Property( "Value Ordering", {"F", "M"} ),

Those buttons on the GUI are just utility buttons to help you create the order of the list.  They are not implemented as parameters in the message itself.  For the message you have to explicitly define the list, and ordering of the items defines the value ordering.

 

If you wanted to mimic the reverse logic, you need to do two things; first get a list of the unique values in the column:

 

dt = open("$SAMPLE_DATA/Big Class.jmp");
summarize(levels=by(dt:sex));
show(levels);

In this example:

 

levels = {"F", "M"};

And to reverse them:

 

reverseInto(levels);
show(levels);

This gives

levels = {"M", "F"};

So now you can write

dt:sex << setProperty("Value Ordering",levels);

Unless of course you really did mean Row Order Levels!

 

-Dave

View solution in original post

2 REPLIES 2
Highlighted
David_Burnham
Super User

Re: With JSL what is the correct syntax to set the Column property "Reverse"

Just to be clear, are you talking about Row Order Levels, or Value Ordering?

 

Row Order Levels I think just takes a flag - your screenshot looks more like value ordering, and that takes a list e.g. 

 

<< Set Property( "Value Ordering", {"F", "M"} ),

Those buttons on the GUI are just utility buttons to help you create the order of the list.  They are not implemented as parameters in the message itself.  For the message you have to explicitly define the list, and ordering of the items defines the value ordering.

 

If you wanted to mimic the reverse logic, you need to do two things; first get a list of the unique values in the column:

 

dt = open("$SAMPLE_DATA/Big Class.jmp");
summarize(levels=by(dt:sex));
show(levels);

In this example:

 

levels = {"F", "M"};

And to reverse them:

 

reverseInto(levels);
show(levels);

This gives

levels = {"M", "F"};

So now you can write

dt:sex << setProperty("Value Ordering",levels);

Unless of course you really did mean Row Order Levels!

 

-Dave

View solution in original post

Highlighted
ALopez
Level III

Re: With JSL what is the correct syntax to set the Column property "Reverse"

Hi David,

Sorry to be so greedy, but I actually want both. So, I will first set the Row Levels for the column

 dt:ColXYZ <<Set Property ( "Row Order Levels", 1 )

and then implement your solution.to get the "Levels" and then Reverse them.  What a bummer that the GUI button does not represent a parameter and it is NOT documented.

Thank you very much for the info.  Nice lesson.

Best regards.