I have a table call dt and it has many columns. I want to find any missing in specific columns and fill with "N". Below is my script, but the col[i] variable not work. I tried replace as column(dt, col[i]) with column(dt, col[i]), but not working. However, when I replace the as column(dt, col[i]) with the true column name (example, :A), the script works. Any suggestion where is my mistake?
col={"A", "B", "C", "D", "E"};
For( i = 1, i<= N Items( col ), i++,
empty_rows = dt << get rows where (is missing(as column(dt, col[i])));
if (nrows(empty_rows) > 0,
as column(dt, col[i])[empty_rows] = "N";
);
);