使用 JSL 进行设置,以便控制图不显示给定参数缺少数据的批次。如题。
通常,在 JSL 中,我们指示批次(由给定列表示),并在控制图上显示点,如下所示:
Local Data Filter(
Close Outline( 1 ),
Add Filter(
columns( :Batch ),
Where(
:Batch == {"01/10/2022", "01/11/2022", "01/12/2022", "01/13/2022"}
),
Display( :Batch, N Items( 15 ), Find( Set Text( "" ) ) )
)
), 但是,我们如何请求考虑所有批次,除了给定参数的 N/A(数据表中的空字段)的批次之外?
JMP 版本:16。
自动化和脚本编写回复:使用 JSL 进行设置,以便控制图不显示给定参数缺少数据的批次。一种方法是使用关联数组来获取所有唯一值,然后仅保留非缺失值。 然后,您可以将其作为列表传递给本地数据过滤器。 下面的例子:
Names Default To Here (1);
//open file and delete a few data points
dt = open ("$SAMPLE_DATA/Abrasion.jmp");
for each ({i}, 6::9,
:Date[i] = .
);
//get non-missing
lstdates = matrix (Associative Array (:Date) << Get Keys);
lstdates = as list(lstdates[loc(!Is Missing(lstdates))]);
//launch cc
cc = Control Chart Builder( Variables( Y( :Abrasion ) ), Show Control Panel( 0 ), );
//launch data filter
ldf = cc << Local Data Filter(
Add Filter(
columns( :Date ),
Where( :Date == lstdates ),
Display( :Date, N Items( 5 ) )
)
);
/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN. BY USING THE CODE, YOU AGREE TO THESE TERMS. YOUR USE OF THE CODE IS AT YOUR OWN RISK. JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose. The Code is designed to add functionality to the Software but has not necessarily been tested. Accordingly, JMP makes no representation or warranty that the Code will operate error-free. JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages. Except as otherwise provided above, the Code is governed by the same agreement that governs the Software. If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies.
*/回复:使用 JSL 进行设置,以便控制图不显示给定参数缺少数据的批次。我非常喜欢在平台内使用转换列。以下是我创建以下脚本的控制图部分的方法:
- 使用所有数据创建控制图
- 在控制面板中,右键单击“日期”并选择“公式”
- 添加 Is Missing 和 Not 函数,以便当日期列不缺失时公式为 true 并关闭对话框
- 右键单击新列并将其重命名为“HasDate”
- 右键单击新列旁边的蓝色三角形,并将其更改为名义数据类型
- 添加本地数据过滤器,转换后的列将自动显示在可用列的列表中
这是您应该得到的:

这是重新创建它的脚本:
Names Default To Here (1);
dt = open ("$SAMPLE_DATA/Abrasion.jmp");
dt << Control Chart Builder(
Transform Column( "HasDate", Nominal, Formula( !Is Missing( :Date ) ) ),
Variables( Y( :Abrasion ) ),
Show Control Panel( 0 ),
Local Data Filter( Add Filter( columns( :HasDate ), Where( :HasDate == 1 ) ) )
);
如果您确定该列对创建视觉效果或进行分析很有帮助,您可以右键单击它并将其添加到数据表中。
回复:使用 JSL 进行设置,以便控制图不显示给定参数缺少数据的批次。很不错, @ih !
回复:使用 JSL 进行设置,以便控制图不显示给定参数缺少数据的批次。谢谢。 我认为你的答案很接近我想要的,只需对代码稍加修改就能让我达到预期的结果。 不幸的是,我正处于 JMP SL 之旅的开始,如果您能帮助我获得能够完全实现我想要实现的目标的代码,我将不胜感激。因此,我将尽力更好地解释我的问题。
我需要说的是,我使用循环来希望针对数据表中的不同参数执行控制图。我无法使用您之前的提示来更改代码以将第 i 列作为要过滤的列。 我尝试过:Column(i),但我不认为是这样的......
我正在分享一段尝试解释我的意思的代码。
For( i = 2, i <= 5, i++,
dt << Control Chart Builder(
lstdates = Matrix( Associative Array( :Column( i ) ) << Get Keys );
lstdates = As List( lstdates[Loc( !Is Missing( lstdates ) )] );
Show Two Shewhart Charts( 0 );,
Sort by Row Order( 1 ),
Include Missing Categories( 0 ),
Show Excluded Region( 0 ), //sprawdź które to które
Show Limit Summaries( 0 ),
Variables( Subgroup( :Batch ), Y( :Column( i ) ) ),
Chart(
Points( Statistic( "Individual" ) ),
Limits( Sigma( "Levey Jennings" ) ),
Warnings( Test 1( 1 ), Test 2( 1 ), Test 3( 1 ), Test 4( 1 ) )
),
ldf = cc << Local Data Filter(
Add Filter( columns( :Column( i ) ), Where( :Column( i ) == lstdates ), Display( :Column( i ), N Items( 5 ) ) )
),
SendToReport(
Dispatch( {}, "graph display 1 title", TextEditBox, {Set Text( "Levey Jennings chart of " || Nazwy[i] )} ),
Dispatch( {}, "Subgroup display 1 title", TextEditBox, {Set Text( "Batch numer" )} )
)
);
)
);
回复:使用 JSL 进行设置,以便控制图不显示给定参数缺少数据的批次。难道你不知道我应该写什么吗:日期,如果我要对数据表中的每个连续参数使用循环“for”?
回复:使用 JSL 进行设置,以便控制图不显示给定参数缺少数据的批次。此示例应向您展示如何将所有连续列放入列表中,然后循环遍历这些列。 顺便说一句,如果您正在查看多个列,您是否考虑过模型驱动多元控制图或过程筛选平台? 两者都擅长简化多个输出的控制图。
Names Default To Here( 1 );
//open sample data table
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
//get all numeric continuous colums, return list as strings
lstcols = dt << Get Column Names( Numeric, Continuous, String );
//run an analysis for each column in the list
For Each( {i}, lstcols,
dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :age ), Y( Column( i ) ) ), //Use each column
Elements( Points( X, Y, Legend( 3 ) ) )
)
);
/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN. BY USING THE CODE, YOU AGREE TO THESE TERMS. YOUR USE OF THE CODE IS AT YOUR OWN RISK. JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose. The Code is designed to add functionality to the Software but has not necessarily been tested. Accordingly, JMP makes no representation or warranty that the Code will operate error-free. JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages. Except as otherwise provided above, the Code is governed by the same agreement that governs the Software. If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies.
*/回复:使用 JSL 进行设置,以便控制图不显示给定参数缺少数据的批次。我认为我不明白的是为什么在我的脚本中通过名称(例如“:name”)引用给定的列可以工作,但通过“column(i)”则不行(我知道在代码中上面我犯了一个错误,写的是:column(i),而不是column(i),但更正它并没有改变任何东西......)