I am trying to create a dummy variable using a for loop.
I am working on the online database called NIS.
I am drying to find a specific diagnosis code across different columns let's say DX2 to DX25. I want to create a new variable hypertension=1 if code is present and 0 if not present across these different column. I tried to use the for loops but it has not been working and I am doing something wrong for sure. I was wondering if someone know how to approach this?