Hi,
I'm looking to create a single data step where I use a repetitive IF statement for 24 columns (income_201001, income_201002, income_201003 ...... ,income_201012, income_201101,income_201102 ...... income_201112) . The first four numbers represent the year (i.e. take values 2010 or 2011) and the last two numbers represent months (1 to 12).
The IF statement I want to use is the following:
IF income_201001 > 0 then flag_1=1; ELSE flag_1=0;
IF income_201002 > 0 then flag_2=1; ELSE flag_2=0;
…
IF income_201111 > 0 then flag_23=1; ELSE flag_23=0;
IF income_201112 > 0 then flag_24=1; ELSE flag_24=0;
What's the quickest way to write this without having to repeat 24 lines of code?
Thanks!