Hi i need help in extracting data using below set of rules/instructions.
I need to skip a day before the actual date of extracting the data , for example todays date is "2022-01-17", so the program should extract data for process_date "2022-01-13", skipping the process_date "2022-01-14". Note that when we skip the dates we exclude or we do not take into consideration Saturday and Sunday, we only focus on weekdays(monday to friday). So in this instance the could should neglect saturday(2022-01-15) & sunday(2022-01-16) then skip the process_date "2022-01-14" and extract the data on process_date "2022-01-13"
Again if i wanted to extract the data on date 2022-01-14, the code should skip the process_date "2022-13-01" and extract the data on the process_date "2022-01-12".
Lastly, if we need to extract the data on date "2022-01-12", the code should run from process_date "2022-01-08" which is saturday & process_date "2022-01-09" which is Sunday up to "2022-01-10" which is monday because some transactions runs on a weekend(saturday and sunday)..kindly Note that this condition only applies if the code is ran on wednesdays for monday process_date which is "2022-01-12" in this instance.
Kindly note that the reason for all of above is because I need to schedule the code to run automatically during weekdays(monday to friday), your help will be highly appreciated!
Data HAVE
data leave;
input process_date :yymmdd10. amount reference &:$50.;
format process_date yymmdd10.;
datalines;
2022-01-08 100 trn01
2022-01-09 200 trn02
2022-01-10 300 trn03
2022-01-11 400 trn04
2021-01-12 500 trn05
2022-01-13 600 trn06
2022-01-14 700 trn07
2022-01-15 800 trn08
2022-01-16 900 trn09
2022-01-17 1000 trn10
;
Data Want - for process date "2022-01-13" which is thursday (First bullet point on the rules/instructions)
process_date amount reference
2022-01-13 600 trn06
Data Want - for process date "2022-01-12" which is wednesday (Second bullet point on the rules/instructions)
process_date amount reference
2022-01-12 500 trn05
Data Want - for process date "2022-01-10" which is Monday (3rd bullet point on the rules/instructions)
process_date amount reference
2022-01-08 100 trn01
2022-01-09 200 trn02
2022-01-10 300 trn03
... View more