IF AND THEN STATEMENT IN SAS

In this post, I will discuss about the “If and then Statements in SAS”. Here , I have created the dataset where I have mentioned emp_id in numbers as well as single character. See the below SS related to Dataset created.

Now, on the above dataset I will apply If and then statement and assign numbers to single character emp_id. See the below code for the same.

DATA EMP_NEW_DET;
SET EMP_DET;
IF EMP_ID="A" THEN EMP_ID= "1";
ELSE IF EMP_ID="B" THEN EMP_ID= "2";
RUN;




Once you execute the above code, the below output will appear.

Related posts