BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
VALLY
Fluorite | Level 6

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    

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Hi and welcome to the SAS Communities 🙂

 

What do you have so far? And what haven't you figured out yet?

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Hi and welcome to the SAS Communities 🙂

 

What do you have so far? And what haven't you figured out yet?

VALLY
Fluorite | Level 6

am still struggling ..i will appreciate if you could help