我們通常將圖形另存為腳本,以備後用。在圖形涉及數據排除之前,所有方法都可以正常工作。例如,我們要繪製出(1)接受疫苗的患者與(2)未接受疫苗的患者的康復情況的圖表。這兩個圖是相同的-變量,軸,標籤和样式相同-區別在於(1)排除了(二進制)“無疫苗”條件,而(2)排除了“疫苗”條件。
我們了解,只要更改數據排除項,圖形就會自動更新(這是一項功能,而不是錯誤)。有沒有一種方法可以將數據排除項保存在圖形的腳本中 ,這樣每當運行腳本時,我們都會在創建圖形時看到基於數據排除的結果?
有不同的方法可以做到這一點。 如果要讓圖表腳本針對新的數據表運行,則該腳本將要求將JSL添加到當時要進行數據選擇的腳本中。 如果任務只是能夠使用相同的數據表設置重新運行圖,那麼需要做的是創建“行狀態”類型的新列,然後在運行時保存行狀態圖的位置到新的行狀態列。 然後,只需增加圖形腳本即可將保存行狀態從新列複製到數據表行狀態,然後運行圖形。
謝謝你的快速反應!
1)您能否指出如何執行此操作?“該腳本將要求將JSL添加到當時通過數據進行選擇的腳本中”。
2)如果上述解決方案還允許我們在同一數據集中指定排除項,則不再贅述。否則,請為我們提供有關如何執行此操作的說明:“然後,只需增加圖形腳本即可將保存行狀態從新列複製到數據表行狀態,然後運行圖形”
或者另一種方法是將本地數據過濾器用作圖形的一部分。這樣,用戶可以輕鬆地從一個組切換到另一組。
這是一個保存示例,然後使用行狀態列將數據表重置回運行原始圖形時的狀態。
names default to here(1);
// Open a sample data table
dt = open("$SAMPLE_DATA/big class.jmp" );
// Set some exclusions and row coloring
dt << select where(:age == 12 & :sex == "F" );
dt << hide and exclude;
dt << color by column(:age);
// Run the graph to get the results desired
Graph Builder(
Size( 522, 486 ),
Show Control Panel( 0 ),
Variables( X( :age ), Group X( :sex ), Overlay( :age ) ),
Elements( Bar( X, Legend( 8 ) ) ),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
);
// To save the data table status at the time of the graph, simply
// create a new row state column, and copy the row states to it
dt << new column("My Row States", rowstate);
dt:My Row States << copy from row states;
// To illustrate what would needed to be added to the Graph Script
// to recreate the environment it was originally run in, I will first
// clear all of the row states to bring the table back to the
// default blank row states
dt << clear row states;
// Now all that has to be done, is to copy the rowstates from the row state
// column back to the data table row states, and then rerun the graph
dt:My Row States << copy to row states;
Graph Builder(
Size( 522, 486 ),
Show Control Panel( 0 ),
Variables( X( :age ), Group X( :sex ), Overlay( :age ) ),
Elements( Bar( X, Legend( 8 ) ) ),
SendToReport( Dispatch( {}, "400", LegendBox, {Set Title( "" )} ) )
);
我認為這並不是您回答的完整答案,但是我不確定您還要求什麼。 您能否重申您的要求並提供更多細節?