Hi everyone, I was researching a lot of forums and for some reason I can't seem to find what I'm looking for so I'm posting here. Apologies if I miss any details. I also won't be able to share too many details since I work with PHI data. What I'm ultimately trying to accomplish is creating a snippet of code that will loop through a list of accounts and start dates and pull information from one designated query where the account and start dates will change based on what is imported from the excel file. I will note here, the excel file is on a shared location and is updated each month to add or remove clients that need to be tracked As an example, here is what the excel (in it's simplest form) looks like: A user can go in and either remove or add clients to this list. So the first "client" listed here, we would pull information starting from 202104 to current (&End_Date) which is already calculated but the second "Client" on here would need to have their information pulled starting in 201905 Account_Name Account_Number Start_Date Alpha 1A1234B 202104 Beta 1B5489H 201905 Gamma 1C5421J 202101 Delta 1W6811C 202012 Epsilon 1G1234U 201911 The code pasted below is what I'm trying to update. Here the &Account_Number and &Start_Date would need change as the loop processes until it reaches the end of the list. Each client will have it's own output table PROC SQL;
CREATE TABLE &Account_Name_&End_Date AS
SELECT
ACCOUNT,
ACCOUNT_NAME,
PERIOD_ID,
SUM(COUNT_MON_NUM) AS MEMBERS
FROM
DATABASE.SR_MBR_MON
WHERE ACCOUNT = &ACCOUNT_NUMBER
AND PERIOD_ID BETWEEN &START_DATE AND &END_DATE
GROUP BY 1,2
;QUIT; Any help would be greatly appreciated and please let me know if I need to be more specific with my ask - thank you in advanced!
... View more