In order to use first. syntax, you must use a BY statement in your data step: BY code;
The =1 is unnecessary, it is implied TRUE. And I don't believe you can use FIRST. together with WHERE (since WHERE does not aware of what is going on in the data step, IF is).