我有兩個日期以 mm/dd/yyyy 格式保存在文本文件中。 我需要分析此日期範圍內的數據並刪除所有其他數據。
我怎樣才能做到這一點?
以下是如何根據從文本文件讀取的日期運行分析的 2 個示例
Names Default To Here( 1 );
// Create a sample data table
dt = New Table( "Example",
Add Rows( 7 ),
New Column( "ACTUAL_SHORT_DATE",
Numeric,
"Continuous",
Format( "m/d/y", 12 ),
Input Format( "m/d/y" ),
Set Values(
[3612470400, 3614025600, 3618777600, 3614457600, 3613420800,
3578947200, 3613939200]
),
Set Display Width( 154 )
),
New Column( "Sample Data",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.865467654397147, 0.551025322305757, -0.780534757628151,
0.590164622893679, -0.084595197133406, 0.93192690045854,
-0.652714499840696]
)
)
);
// Read the data from the text file
textValue = Load Text File( "C:\Temp\DateRange.txt" );
// Parse out the start and end dates
startDate = Informat( Word( 1, textValue, " " ) );
endDate = Informat( Word( 2, textValue, " " ) );
// Select the data that falls within the start
// and end dates
dt << select where(
:ACTUAL_SHORT_DATE > startDate & :ACTUAL_SHORT_DATE < endDate
);
// Subset
dtSub = dt << Subset(
Selected Rows( 0 ),
Rows( [2, 4, 5, 7] ),
Selected columns only( 0 )
);
// Analyze the data
dtSub << Bivariate( Y( :Sample Data ), X( :ACTUAL_SHORT_DATE ) );
Names Default To Here( 1 );
// Create a sample data table
dt = New Table( "Example",
Add Rows( 7 ),
New Column( "ACTUAL_SHORT_DATE",
Numeric,
"Continuous",
Format( "m/d/y", 12 ),
Input Format( "m/d/y" ),
Set Values(
[3612470400, 3614025600, 3618777600, 3614457600, 3613420800,
3578947200, 3613939200]
),
Set Display Width( 154 )
),
New Column( "Sample Data",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[0.865467654397147, 0.551025322305757, -0.780534757628151,
0.590164622893679, -0.084595197133406, 0.93192690045854,
-0.652714499840696]
)
)
);
// Read the data from the text file
textValue = Load Text File( "C:\Temp\DateRange.txt" );
// Parse out the start and end dates
startDate = Informat( Word( 1, textValue, " " ) );
endDate = Informat( Word( 2, textValue, " " ) );
// Select the data that falls outside the start
// and end dates
dt << select where(
:ACTUAL_SHORT_DATE < startDate | :ACTUAL_SHORT_DATE > endDate
);
// Hide and exclude the selected rows
dt << Hide and Exclude;
dt << clear select;
// Analyze the data
dt << Bivariate( Y( :Sample Data ), X( :ACTUAL_SHORT_DATE ) );
感謝您的回复。附加示例文本文件。我的 jmp 表中包含所有數據,其中還包含有效的 JMP 日期列。
1. 文本文件結構是什麼樣的?
2. 要分析的數據是否已在 JMP 數據表中?
3. 要分析的數據中是否存在有效的 JMP 日期列?
基本上,您要做的就是從文本文件中讀取日期。然後找到分析表中滿足該要求的所有行,然後將這些行子集到新的數據表中。最後,您將對子集數據表運行分析。
如果您可以提供有關文本文件和數據文件/表結構的更多詳細信息,我可能會為您找到解決方案。