SAS does have a FORMAT named YYMMDDN, but as the error message says there is no INFORMAT with that name. You can use the YYMMDD informat to read strings of digits that represent dates in year month day order. Also do you want the macro variable to contain the unformatted date value? Or do you want it to contain the original string that looks like a date in YYYYMMDD order? If the later you could probably just treat it as a number instead of date. That is one of the advantages of using Y-M-D ordered strings. They sort properly when treated as text, or raw numbers.
Since the first error caused the SQL query to fail the macro variable is not generated which leads to your later error.
... View more