I am trying to convert some SQL Server code into a SAS proc SQL format but there are a couple of things I have not figured out how to code
SELECT A.[KEY]
,A.[VOLUME]
,A.[DATE]
,A.[FLAG]
--,[PREV_MONTH] = DATEADD(MONTH,-1,A.[DATE])
,[DIFFERENCE] = CASE
WHEN CAST(A.[VOLUME] AS FLOAT) - CAST(B.[VOLUME] AS FLOAT) IS NULL THEN 0
ELSE CAST(A.[VOLUME] AS FLOAT) - CAST(B.[VOLUME] AS FLOAT)
END
,[SUM_] = CAST(A.[VOLUME] AS FLOAT) + CAST(B.[VOLUME] AS FLOAT)
FROM [ATM Index].[dbo].[CIB_FINALE_2] A
LEFT JOIN [ATM Index].[dbo].[CIB_FINALE_2] B
ON B.[KEY] = A.[KEY]
AND B.[FLAG] = A.[FLAG]
AND MONTH(B.[DATE]) = MONTH(DATEADD(MONTH,-1,A.[DATE]))
ORDER BY 1,3,4