I agree with Cynthia, it;s the logic. Multiple "or"s are notorious for causing this sort of conundrum.
If ANY of the variables =1 means program participation, then the first statement is correct. If you have NO missing data, you can get the non-participation by changing he OR's to AND's, viz:
if v2509 = 1 or v2510 = 1 or v2511 = 1 or v2512 = 1 or v2513 = 1 or v2514 = 1 or v2515 = 1 or v2516 = 1 then program_participation = 1;
if v2509 = 0 AND v2510 = 0 AND v2511 = 0 AND v2512 = 0 AND v2513 = 0 AND v2514 = 0 AND v2515 = 0 AND v2516 = 0 then program_participation = 0;
run;
However, most of us have to contend with missing data. These sort of variables are often scored as a 1 if any are 1, and a 0 if any are checked and no 1's, and a missing only if all are missing. If you want that scoring, then the MAX function is the key:
program_participation=MAX(OF v2509-v2516);
as it returns a missing only if all elements are missing.
Doc
... View more