Hello,
I am trying to satisfy multiple (3) conditions in an if-then statement. I think I have the syntax wrong as I'm not getting the output I would expect.
In the sample dataset below:
ID Date1 Date2 Date3 Type Status
1 23Aug12 26Aug12 21Aug12 A 1
1 23Aug12 26Aug12 24Aug12 B 0
2 23Aug12 26Aug12 27Aug12 C 0
2 23Aug12 26Aug12 . . 0
3 23Aug12 26Aug12 . . 0
4 23Aug12 26Aug12 21Aug12 B 0
I've tried the following:
data want;
set have;
if Date3<Date1 and Type='A' and Type is not missing then status=1;
else status=0;
run;
Essentially I want to create a new variable (status) with the output as above. Status would be 1 if date3 occurs before date1, the type is B, and date3 is not missing. I think the 'is not missing' part (or the second 'and') is messing things up.
Thank-you kindly in advance!
Brett