- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Binning Help?
Hi,
I would like to create binned columns by scripting instead of doing it manually (Cols -> Utilities -> Make Binning Formula) but I am not able to figure out how to do so.
1) May I know is there a way to script "Make Binning Formula"? Is yes, can anyone advise me on how to do this?
2) Another question that I would like to ask is, while doing "Make Binning Formula" manually, every selected parameter has their own unique width (refer to the diagram below). How can I retrieve the width value for different parameters? I am currently using "Cholesterol" data from the sample data library as a reference.
I would greatly appreciate any help from anyone of you out there . Thank you.
Regards,
Val
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Binning Help?
Val,
The Make Binning Formula creates a new column, that sets it's Value Labels. If you select to "Use Range Labels" the new column's value labels will look something like:
{18 <= "18 — 26" < 26, 26 <= "26 — 34" < 34, 34 <= "34 — 42" < 42, 42 <=
"42 — 50" < 50, 50 <= "50 — 58" < 58, 58 <= "58 — 66" < 66, 66 <= "66 — 74" < 74,
74 <= "74 — 82" < 82, 82 <= "82 — 90" < 90, 90 <= "90 — 98" < 98, 98 <=
"98 — 106" < 106, 106 <= "106 — 114" < 114, 114 <= "114 — 122" < 122, 122 <=
"122 — 130" < 130, 130 <= "130 — 138" < 138, 138 <= "138 — 146" < 146, 146 <=
"146 — 154" < 154, 154 <= "154 — 162" < 162, 162 <= "162 — 170" < 170, 170 <=
"170 — 178" < 178, 178 <= "178 — 186" < 186, 186 <= "186 — 194" < 194, 194 <=
"194 — 202" < 202}
The list can then be parsed and the lower and upper boundaries can be extracted.
Here is a script that I used against my own data table that the Make Binning Formula had created a column called NPN1 Binning
Names Default To Here( 1 );
dt = Current Data Table();
// Get the Value Labels, and parse them into a list
TheLabels = Char( dt:npn1 binned << get property( "Value Labels" ) );
thelabels = Substr( thelabels, 14, Length( thelabels ) - 14 );
thelabels = Parse( thelabels );
// Create a new table to hold the values
dtbnd = New Table( "Boundries", New Column( "Lower Boundry" ), New Column( "Upper Boundry" ) );
dtbnd << add rows( N Items( TheLabels ) );
// Pass through the list and strip off the upper and lower boundaries
For( i = 1, i <= N Rows( dtbnd ), i++,
dtbnd:Lower Boundry[i] = Num( Word( 1, Char( TheLabels[i] ), "<" ) );
dtbnd:Upper Boundry[i] = Num( Word( 3, Char( TheLabels[i] ), "<" ) );
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Binning Help?
I think the "Interactive Binning" JMP addin that Jeff Perkinson wrote is either an answer to your issue, or at least a good starting point. The addin is available under File Exchange.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Binning Help?
Hi Jim, thanks for the info. I looked into the "Interactive Binning" JMP add in & it's really interesting. However it also seem to be quite manual. Is there any way to get the width for each selected column (as shown in the image above) directly from the pop out window after clicking on "Make Binning Formula"?
Thanks,
Val
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Binning Help?
Val,
The Make Binning Formula creates a new column, that sets it's Value Labels. If you select to "Use Range Labels" the new column's value labels will look something like:
{18 <= "18 — 26" < 26, 26 <= "26 — 34" < 34, 34 <= "34 — 42" < 42, 42 <=
"42 — 50" < 50, 50 <= "50 — 58" < 58, 58 <= "58 — 66" < 66, 66 <= "66 — 74" < 74,
74 <= "74 — 82" < 82, 82 <= "82 — 90" < 90, 90 <= "90 — 98" < 98, 98 <=
"98 — 106" < 106, 106 <= "106 — 114" < 114, 114 <= "114 — 122" < 122, 122 <=
"122 — 130" < 130, 130 <= "130 — 138" < 138, 138 <= "138 — 146" < 146, 146 <=
"146 — 154" < 154, 154 <= "154 — 162" < 162, 162 <= "162 — 170" < 170, 170 <=
"170 — 178" < 178, 178 <= "178 — 186" < 186, 186 <= "186 — 194" < 194, 194 <=
"194 — 202" < 202}
The list can then be parsed and the lower and upper boundaries can be extracted.
Here is a script that I used against my own data table that the Make Binning Formula had created a column called NPN1 Binning
Names Default To Here( 1 );
dt = Current Data Table();
// Get the Value Labels, and parse them into a list
TheLabels = Char( dt:npn1 binned << get property( "Value Labels" ) );
thelabels = Substr( thelabels, 14, Length( thelabels ) - 14 );
thelabels = Parse( thelabels );
// Create a new table to hold the values
dtbnd = New Table( "Boundries", New Column( "Lower Boundry" ), New Column( "Upper Boundry" ) );
dtbnd << add rows( N Items( TheLabels ) );
// Pass through the list and strip off the upper and lower boundaries
For( i = 1, i <= N Rows( dtbnd ), i++,
dtbnd:Lower Boundry[i] = Num( Word( 1, Char( TheLabels[i] ), "<" ) );
dtbnd:Upper Boundry[i] = Num( Word( 3, Char( TheLabels[i] ), "<" ) );
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Binning Help?
There's an option to automatically create binned columns from continuous data. It's under Cols>Utilities>Make Binning Formula. It's very straightforward and provide many options that can then be used to create a new Binned column containing a formula matching your inputs and choices. From here you could easily create a modal window that pops up an prompts you through the next instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Binning Help?
yihjiuntham0, perhaps it will help us if you describe more clearly what you want to do.
Are you looking for a way to give the user of your script access to the Make Binning Formula window but maintain control after they are done?
Or perhaps, you are looking for a way to bin your continuous variables through JSL in a way that's similar to the result you get from Make Binning Formula.
Understanding your end goal will give us a better idea of how to point you in that direction.
-Jeff