I'm usually utilizing SAS EG for simple automated pulls and using the PROMPT option to choose to go back so many quarters or months. However since the database I am working with right now utilizes a Character format, the SAS system does not properly recognize it as a date and therefore I can not utilize the date format ( example 20220312 instead of 12Mar2022). So i have to utilize a CASE WHEN SUBSTR option to break down the character date into quarters that fall between the WHERE option dates. Is there any method in SAS EG that you can tell the code to search for the last 5 quarters of data automatically without having to input dates in it and changing the dates every quarter? It works as is, but I prefer to just automate it as this code below is in several dozen other EGP's and would hate to miss a replacement next quarter. Here are the parts to the code which I have to utilize every quarter; CASE WHEN SUBSTR(WLM.ACQ_DTE, 1, 6) BETWEEN '202204' AND '202206' THEN '2022Q2' WHEN SUBSTR(WLM.ACQ_DTE, 1, 6) BETWEEN '202201' AND '202203' THEN '2022Q1' WHEN SUBSTR(WLM.ACQ_DTE, 1, 6) BETWEEN '202110' AND '202112' THEN '2021Q4' WHEN SUBSTR(WLM.ACQ_DTE, 1, 6) BETWEEN '202107' AND '202109' THEN '2021Q3' WHEN SUBSTR(WLM.ACQ_DTE, 1, 6) BETWEEN '202104' AND '202106' THEN '2021Q2' ELSE 'OTHER' END AS ACQ_Q, WHERE SUBSTR(WLM.ACQ_DTE, 1, 6) BETWEEN '202104' AND '202206'
... View more