use D_LM go #NAME? declare @medate as datetime select @medate = '09/30/2020' CREATE TABLE #TEMP (ALS_NUM varchar(20), LMID bigint, MOD int, LEV int, RELATED bigint, pri_ssn varchar(9), LOANLINE varchar(4)) DECLARE @i tinyint SELECT @i = 2 #NAME? INSERT #TEMP SELECT ORG_ALS_NUM, LMDB_ID, RECOMMEND, 1, NULL, pri_ssn,LOANLINE FROM d_lm.ALLBooked WHERE MONTH(DATE_BOOKED) = MONTH(@MEDate) AND YEAR(DATE_BOOKED) = YEAR(@MEDate) --Now search these and see if any of these are new acct nubers for a prior 'booked' loan --loop 5 times to find any more iterations of the same loan WHILE @i < 10 BEGIN INSERT #TEMP SELECT v.ORG_ALS_NUM, v.LMDB_ID, v.RECOMMEND, @i, t.LMID , v.pri_ssn, v.LOANLINE FROM d_lm_ALLBooked v JOIN #TEMP t ON (t.ALS_NUM = v.NEW_ALS_NUM or t.als_num = v.org_als_num) AND v.LMDB_ID NOT IN (SELECT LMID FROM #TEMP) SELECT @i = @i + 1 END
You cannot run this code however her is my question. The code came to me in T-SQL format. I am trying to run each section and produce a dataset so I can get a visual on how to connect the datasets. Can this be dumped into a third party app like toad or SSRS. What have some of you utilized in cases like this?
Why do you need to decode? You can continue to run this code as is from SAS using SQL Passthru and the EXECUTE statement. If the results need to come back to SAS you can read the #temp table in a following SQL query.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.