05-14-2013 02:46 PM
create table pay1 as
select id, due_date
BreakDate=due_date+5 /*Example if the due_date is 05/25/2013 this variable returns 05/30/13*/
My question is, I use macro that automatically accounts for previous business day. If a day falls on Sunday, the macro &pbd will assign a Monday date. For example &pbd+5 will return an number value for 5 days after the previous business day. I then can format it to look like an actual date.
I need to incorporate due_date and &pbd together to produce the next business days after the 5 days has elapsed. For example if I use the formula in my program:
If the due_date=05/14/13,the BreakDate will equal 5/19/13, which is Sunday. I want to default to Monday. I need to use both the due_date and &pbd to accomplish this. Or is there an easier way? Perhaps just say if the BreakDate falls on Sunday, automatically increment to Monday?
05-14-2013 03:32 PM
how about the last logic,
If the Breakdate falls on Sunday, automatically increment to Monday.
if weekday(break_date)=1 then break_date=break_date+1;
put break_date date9.;
05-15-2013 12:23 AM
data want (drop =i);
informat break_date date9.;
format break_date date9.;
do i = 1 to (3*30);
if weekday(break_date) = 1 then
05-15-2013 04:50 AM
It is simple by using DATA Step as follow...
data test(drop = _temp);
format due_date break_date date9.;
due_date = "01Jan2013"d;
break_date = due_date + 5;
_temp = weekday(break_date);
if _temp = 1 then do;
break_date = due_date + 6;
break_date = break_date;
05-15-2013 09:33 AM
What is in the macro variable &BPD ?
1) How is it formatted? If it is formatted as DATE9. format outputs data then you can use it as a date literal in your SQL statements. For Example: if break_date= "&BPD"d.
2) What does the value of BPD represent? Is it one number that will apply to all observations? If not then you need a way to get the value of BPD that is right for the current observation. Perhaps by creating a separate table you can merge onto your data? Or a format?