I appreciate if anyone can help me with the logic as I am new to SAS.
I have a dataset where I had to compare the values of 12 columns against each other.
Scenario: I have Column1, Column2… Column12. The values in all the columns can only be either 1 or 0. I should compare 2 columns and make sure if the value is changing from 1 to 0. If yes, then I should make sure that it remains 0 for 5 more columns starting from second column. I am planning on having a new column with a flag to say ‘Yes’ if it meets the above criteria or else ‘No’.
Row1: Col1 has Product1, Column2 has Warehouse1, Column3 through Column14 has values of 1’s and 0’s. Now, I have to do a check for column3 through column14. Now I have to test that if the value in Column 3=1 and Column 4 = 0 then values from Column 5 through Column 8 should be 0’s and at the same time if Column 9 =1 and Column 10 = 0 then values from Column 11 through Column 14 should be 0’s.
Row2: If Column 3= 1 and Column 4= 1 then there is no rule to be applied. But if in the same row if Column 5=0 then values from Column 6 through Column 9 should be 0’s. (I should see that they are 0’s for atleast 5 columns including Column )5
Note: I should only make sure that the values in the columns are 0’s only if there was a change in value between previous column from 1 to 0.
I hope it is clear now. Please let me know if you have any questions.