Using nested case in Proc sql, I need to get the value of a column based on the specified year and month. For eg - If the year is 2018 and the month is december then it should return the value of the column x201811 and if it is null it should return zero. The code which I have written below is giving a syntax error. Please suggest a solution.
CASE WHEN (( Year(date) = 2018 ) AND ( Month(date) = 12 )) THEN x201811
WHEN x201811 IS NULL THEN 0
ELSE x201811
WHEN ((Year(date)=2018) AND (Month(Date)=11)) THEN x201810
WHEN x201810 IS NULL THEN 0
ELSE x201810