
1
2
Creating Variables Conditionally
2.1 The IF-THEN/ELSE Statement
Creating variables in the DATA step is an essential task in DATA step pro-
gramming. If the assigned values to the newly created variable are the same
across all the observations, the variable can be created by using the assign-
ment statement. However, in most applications, assigned values are often
different across the records, and these values are generated depending upon
a certain condition. In this situation, a common approach to creating a vari-
able conditionally is to use the IF-THEN/ELSE statement.
2.1.1 Steps for Creating a Variable
When creating a new variable, novice p ...