名前はデフォルトでここに設定されます(1); ask_steps = function({}, {Default Local}, nw = New Window("イベントステップの時間を入力してください", << Type("Modal Dialog"), << Return Result, H List Box( Panel Box("ステップを入力してください", Lineup Box(N Col(2), Text Box("Min Time"), neb_min = Number Edit Box(.), Text Box("Max Time"), neb_max = Number Edit Box(.), Text Box("Step Time"), neb_step = Number Edit Box(.), Text Box("Interpolate last"), cb_interpolate = Check Box({""}, << Set All(1)) ) ), Spacer Box(Size(20, 0)), Panel Box("Actions", Button Box("OK"), Button Box("Cancel") ) ) , << Set Window Icon("Survival") ); If(nw["Button"] != 1, Throw("キャンセルされました"); ); min_t = nw["neb_min"]; max_t = nw["neb_max"]; step_t = nw["neb_step"]; If(Any(Is Missing(min_t), Is Missing(max_t), Is Missing(step_t)), Throw("ステップが入力されていません"); ); interpolate_last = N Items(nw["cb_interpolate"]); return(Eval List({min_t, max_t, step_t, interpolate_last})); ); add_risk_table = function({platform_ref, min_t, max_t, step_t, interpolate_last}, {Default Local}, rep = Report(platform_ref); dt = platform_ref << Get Data Table; ycol = ((rep << XPath("//TextBox[text()='Time to event: ']"))[1] << sib) << get text; grouping_col = ((rep << XPath("//TextBox[text()='Grouped by ']"))[1] << sib) << get text; Summarize(dt, groups = by(Eval(grouping_col))); steps = min_t::max_t::step_t; vals = steps; For Each({group}, groups, m_tb = rep[OutlineBox(group), Table Box(1)] << get as matrix; times = m_tb[0, 1]; atrisk = m_tb[0, N Cols(m_tb)]; cur_steps = Step(steps, times, atrisk); // この場合、最後の 1 つは想定されません If(interpolate_last, If(times[N Rows(times), 1] < max_t & Is Missing(cur_steps[N Cols(cur_steps)]), cur_steps[N Cols(cur_steps)] = atrisk[N Rows(times), 1]; ); ); vals = vals |/ cur_steps; ); pb = Panel Box("Risk Table", tb_results = Table Box( String Col Box(Eval Insert("No at Risk (^ycol^)"), groups), )); For(i = 1, i <= N Cols(vals), i++, cur_vals = vals[0, i]; title = Char(Remove From(cur_vals, 1)[1]); tb_results << Append(Number Col Box(title, cur_vals)); ); rep[List Box(2)] << Append(pb); rep[List Box(2)] << Append(Spacer Box(Size(0, 10))); ); cur_rep = Current Report(); If(Is Empty(cur_rep), Throw("レポートが開いていません"); ); ob_refs = cur_rep << XPath("//OutlineBox[
@helpKey='Surv']"); If(N Items(ob_refs) == 0, Throw("Surv プラットフォームが見つかりません"); ); Try( {min_t, max_t, step_t, interpolate_last} = ask_steps(); For Each({ob_ref}, ob_refs, platform_ref = ob_ref << get scriptable object; add_risk_table(platform_ref, min_t, max_t, step_t, interpolate_last); ); , Throw("その他の問題: " || char(exception_msg)); ); Write();