You could still loop it, but use Summarize instead of functions Col functions which might not work with the byVar. This is one option:
Names Default To Here(1);
dt = Current Data Table();
col_list = {"Value 1", "Value 2"};
For Each({col_name}, col_list,
Summarize(dt, groups = By(:Group), v_std = StdDev(Eval(col_name)));
Show(col_name, v_std);
Show(Mean(v_std));
Show(Median(v_std));
);
Here is other option with Summary table could be used (two ways for calculations) :
Names Default To Here(1);
dt = Current Data Table();
col_list = {"Value 1", "Value 2"};
dt_summary = dt << Summary(
Group(:Group),
Std Dev(EvalList({col_list})),
Freq("None"),
Weight("None"),
statistics column name format("column"),
Link to original data table(0),
invisible
);
For Each({col_name}, col_list,
mea = Mean(dt_summary[0, col_name]);
med = Median(dt_summary[0, col_name]);
// or
mea1 = Col Mean(As Column(col_name));
med1 = Col Median(As Column(col_name));
Show(col_name, mea, med, mea1, med1);
);
Close(dt_summary, no save);
-Jarmo