我可能没有完全理解该要求。据我所知,所有列都是字符,除了名称之外,没有其他信息可以标识日期时间列。如果该名称始终相同,则无需遍历各列,只需在脚本中命名即可。另一种方法是编写一个小对话框,让用户选择要转换的列。我也没有确切地达到目标是什么:日期是否应该在世界各地以相同的格式显示,还是根据本地设置显示?目前,我假设相应的列始终具有相同的名称,并且日期格式应以本地格式显示。然后,附加的脚本可能会完成至少部分需要完成的工作。
我有要适当格式化的表格(也附有)

主要的复杂性来自以下三个问题:
- 该脚本的用户将具有不同的日期格式,因为他们将使用不同的语言使用不同的Windows计算机。例如,该列的数据库输入约会时间 (总是)格式 dd-mon-yyyy hh:mm:ss 西班牙语或德语不存在。

2。用户还将具有不同的数字格式。所有列将导致空数值,因为它期望小数点的逗号(3.14将不会被识别为3,14)。
3。第一列(始终是日期时间)之后,列可以包含数字或分类值。在随附的示例中,column3包含注释,因此不需要更改格式。
潜在的解决方案:
问题1(使用语言环境的日期时间)
也许更容易的是验证JMP语言是否为英语,激活/停用忽略语言环境设置的选项:
dt = Current Data Table();
<BR />// TODO assert that JMP language is English
Preferences( Use JMP Locale Settings( 1 ) );
dt:datetime<< Set Data Type( Numeric ) << Modeling Type( continuous ) << Format( "Locale Date Time h:m:s" );
Preferences( Use JMP Locale Settings( 0 ) );
dt:datetime<< Format( "Locale Date Time h:m:s" );
问题二
要将格式从英语更改为语言环境,我们可以做类似的事情。这篇文章中的更多信息
https://community.jmp.com/t5/Martin-Demel-s-Blog/JMP-and-Excel-A-Never-ending-story-Part-2/ba-p/35099
dt = Current Data Table();<BR />
// TODO assert that JMP language is English
Preferences( Use JMP Locale Settings( 1 ) );
dt:column1 << Set Data Type( Numeric ) << Modeling Type( continuous );
Preferences( Use JMP Locale Settings( 0 ) );
dt:column1 << Set Data Type( Numeric ) << Modeling Type( continuous );
问题三
如何使用JMP的最佳猜测进行编码,使列仅从字符传递到数字?
在这篇文章之后: https://community.jmp.com/t5/Discussions/Convert-data-to-numeric-Only-If-Appropriate/td-p/106692
dt = CurrentDataTable();
// TODO Assert that JMP is in English
Preferences( Use JMP Locale Settings( 1 ) );
// Convert to numeric only if nedeed
For( i = 2, i <= N Cols( dt ), i++,
isNumeric = "NO";
For( theRow = 1, theRow <= 10, theRow++,
If( Column( i )[theRow] != "" & Is Missing( Num( Column( i )[theRow] ) ) == 1,
isNumeric = "NO";
Break();
,
isNumeric = "YES"
)
);
If( isNumeric == "YES",
Column( i ) << set data type( numeric ) << Modeling Type( continuous );
Preferences( Use JMP Locale Settings( 0 ) );
Column( i ) << set data type( numeric ) << Modeling Type( continuous );
Preferences( Use JMP Locale Settings( 1 ) );
);
);
Preferences( Use JMP Locale Settings( 0 ) );
我缺少确保JMP用英语以及是否有更有效的方法(可能有100,000行和数百列)的主张。
你好,
无法通过JSL访问“ Windows”选项卡中的所有首选项。因此,仅解决方法是可能的。一项建议,测试当前语言是否为英语,如果没有解释用户如何更改它。
If( (Num( "2.1" ) == 2.1),
"English",
lw = New Window( "Warning: inappropriate formatting options",
V List Box(
Spacer Box( Size( 600, 20 ) ),
H List Box(
Spacer Box( Size( 20, 20 ) ),
V List Box(
Text Box( "Warning\!n", <<SET wrap=""> Preferences --> Windows-specific
Set \!"Display Language\!" to \!"English\!" AND
check the box next to \!"Use JMP language rather than System locale settings,...\!n
Then re-start this program\!n",
<<SET wrap=""></SET></SET>
最好的祝福
伯恩德