I'm trying to create and fill a column: 'FLAG' ,using data from two tables: carteira_base30 and TRIGGERS_21.
Whenever carteira_base30.Data_ref is 31DEC2015 (format: DATE9.) it should retrieve info from TRIGGERS_21.D31DEC2015 (column in number format with values 0 and 1).
The following code returns me: ERROR: Result of WHEN clause 2 is not the same data type as the preceding results. Can you help me out?
PROC SQL;
CREATE TABLE carteira_base31 AS
SELECT x.*,
CASE x.Data_ref
WHEN '31DEC2015'd THEN y.D31DEC2015
ELSE 'Other'
END AS 'FLAG'n
FROM carteira_base30 x
LEFT JOIN TRIGGERS_21 y
ON x.NIF = y.NIF;
QUIT;
question from:https://stackoverflow.com/questions/66063760/proc-sql-case-when-expression-result-of-when-clause-2-is-not-the-same-data-ty