If conditions in SAS

sas

#1

Hello,

I have used the below code while learning about if in SAS.

data test;
   input X;
   if X = 3 or 4 then Match = 'Yes';
   else Match = 'No';
datalines;
3
7
.
;

What should happen is that for 3 it should be Y and N for the others.But the output as shown below is not proper.

What is wrong here?


#2

Try by replacing “if X = 3 or 4 then Match = ‘Yes’;” to “if X = 3 or X=4 then Match = ‘Yes’;”

Hope it should work now.
Tavish