有关导入多个 TXT 文件并删除某些数据的脚本的帮助 JMP 15你好,
我想将多个TXT文件导入到一个数据表中。
单个 TXT 文件如下所示,我只想导入突出显示的数据,如果可能的话,创建一个新列来捕获批次号。

我编写了以下脚本(如下),该脚本使我部分实现了目标,但我仍然需要删除下面突出显示的一些数据。 当我只有几个文件时这还可以,但当文件超过 10 个时,这就有问题了。

任何人都可以建议添加脚本来解决此问题吗? 我目前正在使用 JMP 15。
谢谢你!
Multiple File Import(
<<SET folder=""></SET>
高级统计建模自动化和脚本编写消费者和市场研究数据存取数据混合和清理大规模定制回复:有关导入多个 TXT 文件并删除某些数据的脚本的帮助 JMP 15我猜前面有一个空白字符[D105_Unf25]。下面的脚本应该可以解决这个问题
Names Default To Here( 1 );
dt = Current Data Table();
// Create a new column to hold the parameter name
dt << New Column( "Parameter",
character,
set each value(
If( Left( trim(:col1), 1 ) == "[",
temp = Word( 1, trim(:col1), "[]" );
);
temp;
)
);
// Find all measurement rows and subset them to a new table
dt << select where(isMissing(Num(:col2))==0);
dtMeasures = dt << subset( selected rows(1), selected columns(0));
// Convert the Measure data to numeric
dtMeasures:col4 << datatype(numeric)<<MODELINGTYPE></MODELINGTYPE>
回复:有关导入多个 TXT 文件并删除某些数据的脚本的帮助 JMP 15嗨吉姆,
谢谢 :)
回复:有关导入多个 TXT 文件并删除某些数据的脚本的帮助 JMP 15@肯迪这是一个脚本,应将您的测量列转换为每个参数的单独列
Names Default To Here( 1 );
dt = Current Data Table();
// Create a new column to hold the parameter name
dt << New Column( "Parameter",
character,
set each value(
If( Left( :col1, 1 ) == "[",
temp = Word( 1, :col1, "[]" );
);
temp;
)
);
// Find all measurement rows and subset them to a new table
dt << select where(isMissing(Num(:col2))==0);
dtMeasures = dt << subset( selected rows(1), selected columns(0));
// Convert the Measure data to numeric
dtMeasures:col4 << datatype(numeric)<<MODELINGTYPE></MODELINGTYPE>
回复:有关导入多个 TXT 文件并删除某些数据的脚本的帮助 JMP 15不适用
回复:有关导入多个 TXT 文件并删除某些数据的脚本的帮助 JMP 15@本弗朗西斯效果很好。 感谢您的帮助!
回复:有关导入多个 TXT 文件并删除某些数据的脚本的帮助 JMP 15你好@克莱尔BH ,
除了多文件导入代码之外,下面的 JSL 也应该可以解决问题。 它主要与昨天刚刚发布的 JMP 16 中的增强日志放在一起。
亲切的问候,
本
</CODE></P>
<PRE><CODE class=" language-jsl">// Setup and point to open data table
Names Default to Here(1);
dt = Current Data Table();
// Highlight Batch# rows
dt << Select Where( :Column 1 == "Batch#" );
// Make a subset of Batch# rows
dt_batch = dt << Subset( Output Table( "Batch Numbers" ), Selected Rows( 1 ), selected columns( 0 ) );
// Change name in subset so doesn't overwrite when joined back onto
dt_batch:Time << Set Name("Batch No");
// Delete unwanted rows
dt << Select Where( Is Missing( :V 2 ) ) << Delete Rows;
// Pull Batch No into main table
dt << Update(
With( dt_batch ),
Match Columns( :File Name = :File Name ),
Add Columns from Update Table( :Batch No ),
Replace Columns in Main Table( None )
);
// Close subset with Batch No
Close(dt_batch, nosave)
// Move selected column: Batch No
Data Table( "SAS_TEST_FILE_FROM_1_SAS_TEST_FILE_FROM_3" ) <<
Move Selected Columns( {:Batch No}, after( :Column 1 ) );
// Delete column: Column 1
Data Table( "SAS_TEST_FILE_FROM_1_SAS_TEST_FILE_FROM_3" ) <<
Delete Columns( :Column 1 );