Using loop variable as column inputHello,
I am wondering if it possible to use my for loop variable, i, as an input for a new column, depending on the value of another column. Here is what I am thinking, but cannot get to work.
dt << New Column("Site", Numeric, Formula(
For(i = 1, i <= 8, i++,
If(Contains(:Column1, i), i);
)
));
Advanced Statistical ModelingQuality and Process EngineeringRe: Using loop variable as column inputYou certainly can. The only issue you have is that the Contains() function is a character handling function, and the arguments passed to it must be character(string) values. I am assuming :Column1 is a character column so all you need to do is to convert the index variable "i" from a numeric to character
dt << New Column("Site", Numeric, Formula(
For(i = 1, i <= 8, i++,
If(Contains(:Column1, char(i) ), i);
)
));