Hi ,
Here is my code in which i have implemented most of the logic except one thing .
I have one input data by name Demo.INPUT_2 which contains the date column by name "Initiated" and another location column.
Can anyone suggest that how can i use their combination directly in if then else statement in my program.
Basically , i want to compare the date and location from my input data with the hard corded date and location in the below conditon
where i have added the /*Holiday List */ comment.
DATA DEMO.INPUT_4;
SET DEMO.INPUT_2;
FR_DATE = DATEPART(INITIATED);
FR_TIME = TIMEPART(INITIATED);
FORMAT FR_TIME TIME8.2;
FORMAT FR_DATE DATE9.;
J = 0;
NEW_TIME = FR_DATE;
DO WHILE(J = 0);
/*Holiday List */
IF PUT(NEW_TIME,DATE9.) IN
(
'01JAN2018'
,'15JAN2018'
,'26JAN2018'
,'12FEB2018'
,'02MAR2018'
,'30MAR2018'
,'30APR2018'
,'01MAY2018'
,'01JAN2018'
,'16JUN2018'
,'15AUG2018'
,'22AUG2018'
,'13SEP2018'
,'02OCT2018'
,'18OCT2018'
,'07NOV2018'
,'08NOV2018'
,'21NOV2018'
,'25DEC2018'
)
THEN NEW_TIME = INTNX('DAY',NEW_TIME,+1);
ELSE IF NEW_TIME = NWKDOM(1,7,MONTH(NEW_TIME),2018) THEN NEW_TIME=INTNX('DAY',NEW_TIME,+2);
ELSE IF NEW_TIME = NWKDOM(2,7,MONTH(NEW_TIME),2018) THEN NEW_TIME=INTNX('DAY',NEW_TIME,+2);
ELSE IF WEEKDAY(NEW_TIME)= 1 THEN NEW_TIME=INTNX('DAY',NEW_TIME,+1);
ELSE J = 1;
END;
FORMAT NEW_TIME DATE9.;
APP = '10:00:00'T;
FORMAT APP TIME8.2;
FORMAT NEW_TIME_UPDATE DATETIME20.;
IF FR_TIME > '14:00:00'T AND NEW_TIME
THEN NEW_TIME_UPDATE = DHMS(NEW_TIME,0,0,APP);
ELSE NEW_TIME_UPDATE = INITIATED;
RUN;
Thanks in advance.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.