我将使用一种交互式方法来为此捕获脚本。 首先,让我们从数据表开始:

我离开了Count,因为我们不需要它,但是如果有的话它不会受到伤害。
我选择了“分数”列,然后导航至“列数”,“实用程序”,“合并装箱公式”:

并将“偏移”设置为0.5,并将bin宽度设置为0.1:

右键单击新列(“分值”),然后单击“复制列属性”:

然后打开一个新的脚本窗口并粘贴(ctrl-V),这将导致此JSL:
Add Column Properties(
Value Labels(
{-0.5 = "-0.5 — -0.4", -0.4 = "-0.4 — -0.3", -0.3 = "-0.3 — -0.2", -0.2 =
"-0.2 — -0.1", -0.1 = "-0.1 — 0", 0 = "0 — 0.1", 0.1 = "0.1 — 0.2", 0.2 =
"0.2 — 0.3", 0.3 = "0.3 — 0.4", 0.4 = "0.4 — 0.5", 0.5 = "0.5 — 0.6", 0.6 =
"0.6 — 0.7", 0.7 = "0.7 — 0.8", 0.8 = "0.8 — 0.9", 0.9 = "0.9 — 1", 1 =
"1 — 1.1", 1.1 = "1.1 — 1.2", 1.2 = "1.2 — 1.3", 1.3 = "1.3 — 1.4", 1.4 =
"1.4 — 1.5", 1.5 = "1.5 — 1.6", 1.6 = "1.6 — 1.7", 1.7 = "1.7 — 1.8", 1.8 =
"1.8 — 1.9", 1.9 = "1.9 — 2"}
),
Use Value Labels( 1 ),
Formula( 0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 ) )
)这里有两件事:我们不在乎任何分数小于0.5(在您的描述中不存在)或大于1,因此我们可以稍微更改属性并编辑标签名称以匹配您想要的分数。 我还添加了一个If语句来捕获分数恰好为1的极端情况
Add Column Properties(
Value Labels(
{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
"0.9 — 1"}
),
Use Value Labels( 1 ),
Formula(
If(
(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
)
)
);(顺便说一下,这些标签在技术上并不准确,因为0.599会被标记为介于0.5和0.59之间)
我们可以在此代码段周围包装一些代码以使其可重用,在这里使用当前数据表,添加一个名为Score Binned的新列,并将这些属性添加到该列:
dt = Current Data Table();
dt << New Column("Score Binned", Character);
dt:"Score Binned"n << Add Column Properties(
Value Labels(
{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
"0.9 — 1"}
),
Use Value Labels( 1 ),
Formula(
If(
(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
)
)
);现在,回到表上,“表>摘要”将我们带到了想要去的地方。 我们将“分组”和“分数绑定”放入“分组”,这就是我们实际需要的:


现在,N行是我们想要的,它只是被命名错误,所以让我们双击左侧的“ Source”一词,然后复制表创建脚本,并将命名的表引用替换为工作表中的“ dt”,并捕获变量“ summ”中的新表:

dt = Current Data Table();
dt << New Column("Score Binned", Character);
dt:"Score Binned"n << Add Column Properties(
Value Labels(
{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
"0.9 — 1"}
),
Use Value Labels( 1 ),
Formula(
If(
(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
)
)
);
summ = dt << Summary(
Group( :Group, :Score Binned ),
Freq( "None" ),
Weight( "None" )
);最后,根据需要将N行重命名为“ Total_Count”:
dt = Current Data Table();
dt << New Column("Score Binned", Character);
dt:"Score Binned"n << Add Column Properties(
Value Labels(
{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
"0.9 — 1"}
),
Use Value Labels( 1 ),
Formula(
If(
(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
)
)
);
summ = dt << Summary(
Group( :Group, :Score Binned ),
Freq( "None" ),
Weight( "None" )
);
summ:"N Rows"n << Set Name("Total_Count");现在,关闭摘要表,从源表中删除“得分绑定”列,然后测试脚本:

最终的JSL:
dt = Current Data Table();
dt << New Column("Score Binned", Character);
dt:"Score Binned"n << Add Column Properties(
Value Labels(
{0.5 = "0.5 — 0.59", 0.6 = "0.6 — 0.69", 0.7 = "0.7 — 0.79", 0.8 = "0.8 — 0.89", 0.9 =
"0.9 — 1"}
),
Use Value Labels( 1 ),
Formula(
If(
(0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )) == 1, 0.9,
0.5 + 0.1 * Floor( (:Score - 0.5) / 0.1 )
)
)
);
summ = dt << Summary(
Group( :Group, :Score Binned ),
Freq( "None" ),
Weight( "None" )
);
summ:"N Rows"n << Set Name("Total_Count");测试了您所附的数据,我刚刚才注意到:flushed_face:

这里有几种方法可以做到这一点。但是由于下面的示例实际上仅基于主要的JMP功能,因此我强烈建议您从“帮助”下拉菜单下的“ JMP文档库”中阅读“发现JMP”和“使用JMP”文档。
Names Default To Here( 1 );
dt = Current Data Table();
dt << New Column( "Score Category",
character,
formula(
If(
:Score < .6, "0.50-0.59",
:Score < .8, "0.60-0.79",
:Score < .9, "0.80-0.89",
"0.90-1.00",
)
)
);
dtSum = dt << Summary(
Group( :Group, :Score Category ),
Sum( :Count ),
Freq( "None" ),
Weight( "None" ),
Link to original data table( 0 )
);
dtSum << delete columns( :N Rows );
dtSum:Name( "Sum(Count)" ) << set name( "Total_Count" );
// or
dt:score << set property(
"value labels",
{0.5 <= "0.50-0.59" < 0.6, 0.6 <= "0.60-0.79" < 0.8, 0.8 <= "0.80-0.89" < 0.9, 0.9
<= "0.90-1.00" <= 1}
);
dtSum = dt << Summary(
Group( :Group, :Score ),
Sum( :Count ),
Freq( "None" ),
Weight( "None" ),
Link to original data table( 0 )
);
dtSum << delete columns( :N Rows );
dtSum:Name( "Sum(Count)" ) << set name( "Total_Count" );