hi folks, I have a question regarding how I can combine a number of columns created in my table, into a new column that describes whether any of these columns have a specific char value ("screened").
Currently my datasets are analyzed with a script that adds "n" new columns that contain the char values "screened" and "unscreened" based on formulas in the script.
My goal is to include in the script a final step that adds a new column that evaluates the value in each of the 'n' new columns and if for each row, any of those columns are 'screened' then it labels that row as screened.
If the number of new columns was always the same, I would just write a long-ish If statement, checking the value in each column. However, I need to script it to look at 'n' number of columns. I thought to use a FOR loop inside of a forumula, e.g., something like:
dt << New Column("All_screens",character,nominal,setformula(
If( For( i = 1, i <= N Items( individualScreenColumns ), individualScreenColumns == "Screened"), ---> need some magic such that if any of the screening columns contain screen, then ---> "Screened", "Unscreened" ));
But since FOR loops don't return any value, I couldn't figure this magic out. Does anyone have any thoughts?
Thanks,
--Peach