Auswerten von Col Mean mit IterationenHallo allerseits,
Ich habe Probleme beim Auswerten einer col mean-Funktion. Wie Sie unten sehen können, fügt col mean(:age, :list_col_names[i]] das Element nicht in die Liste der Datentabelle ein. Wenn ich mit dieser aktuellen Konfiguration die Formel in der Datentabelle öffne, erhalte ich "Col Mean (:age, list_col_names[i] )", was nichts auf der list_col_names-Liste entspricht.
list_col_names = fdt << getColumnNames( "String" );
For( j = N Items( list_col_names ), j > 0, j--,
If( Left( list_col_names[j], 2 ) != "10",
Remove From( list_col_names, j )
)
);
For( i = 1, i <= N Items( list_col_names ), i++,<BR /> fdt << New Column( list_col_names[i] || "_age", Numeric, Formula( Col Mean( :age, :list_col_names[i] ) ) ) <BR />);
in einer Iteration einschalten
Betreff: Auswertung von Col Mean mit IterationenFunktioniert super. Danke Vinc!
Betreff: Auswertung von Col Mean mit IterationenSie können nicht tun: list_col_names [i], Sie geben ausdrücklich an, dass Sie eine Spalte namens "list_col_names" haben und ziehen die i-te Zeile davon.
Versuche dies
Names Default to here(1);
fdt = open("$SAMPLE_DATA\Big Class.jmp");
list_col_names = {"sex", "name"};
For( i = 1, i <= N Items( list_col_names ), i++,
//this is just it doesn't keep the variable
//in the table because i will change and then your column name will change
Eval(
EvalExpr(
fdt << New Column( list_col_names[i] || "_age",
Numeric,
Formula( Col Mean( :age,
//replaces the string column name with an actual column
Expr(Column(fdt, list_col_names[i]))
) )
)
)
)
);