The issue is that an observation in the second dataset on SELECT clause will become missing in the created new dataset if the observation is missing in the first dataset on SELECT clause.
To deal with this issue, Jorgensen describes that there are THREE approaches to handling the issue of incoming datasets having variables with the same name. In this article, I will explain the third bullet.
- Always select the value from one dataset
- Keep the variables from both datasets as separate variables in the output dataset
- Assign the value of the output variable based on the values of the incoming variables
- The CASE statement: PROC SQL's approach of allowing conditional assignment of values.
- The COALESCE statement: A function that allows the selection of the first non-missing value in a list of variables.
REFERENCE:
Jorgensen G. 'PROC SQL: Tips and Translations for Data Step Users.' NESUG 2009. PDF File
Post a Comment
別ページに移動します