Hi Kurt, Below is the current example and please note every Mondays, the 'old date' must be Thursdays and the 'new date' must be Saturdays. Every Tuesdays, the 'old date' must be Saturdays and 'new date' must be Mondays. Every other day from Wed-Friday 'old date' is today() minus 2 and 'new date' is today() minus 1. * Date Comparisons; %let old = '17Apr2018'd; ;*old date; %let new = '18Apr2018'd; ;*new date %_eg_conditional_dropds(WORK.DAILY_T); PROC SQL; CREATE TABLE WORK.DAILY_T AS SELECT Date, AccNo, BranchNumber, AccBal FROM ACCOUNT_DAILY_TABLE WHERE Date IN (&old, &new); RUN; I can easily use the intnx function to do Wed-Fri like below but having issue trying to figure out a way to do Mon and Tues. For example: Proc Sql; Create Table DAILY_T as Select Date, (case when Date = today()2 then 'Previous' else 'Current' end) as Period, AccNo, BranchNumber, AccBal From ACCOUNT_DAILY_TABLE where Date >=intnx ('day',today(),-2); Quit; Can you please help me with a function or data step to do all in once: if Monday, then 'old date' is Thur and 'new date' is Saturday if Tuesday, the 'old date' is Saturday and 'new date' is Monday else 'old date' is today() minus 2 and 'new date' is today() minus 1 ----OUTPUT----- The output has to have 2 records of the same account - 1 record for 'old date' and 1 record for 'new date' Highly value your help. Thanks kindly, Mags
... View more