In Base SAS®, SQLPLAN errors might occur if any of the following is true for the SQL procedure query:
To work around the issue, use the code that was used to create the second new variable on the HAVING clause rather than using the new variable name.