Hi All,
I need help with some code using either if, then, else, or an array.
I have a data set with many medication fields (wide data set). They are labeled medication1-medication29. I want to create a new variable called "code" that is equal to 1, if any of the 29 medications = 258. Then if medications =225 or 265 then code =2.
Here is some sample code I was playing with:
if (medication1 or medication2 or medication3 or medication4 or medication5...medication29)=258 then code=1;
else if (medication1 or medication2 or medication3 or medication4 or medication5...medication29)=225 or (medication1 or medication2 or medication3 or medication4 or medication5...medication29)=265 then code=2;
...
Thanks!
Sarah
... View more