BookmarkSubscribeRSS Feed
VaibhavGhoghari
Fluorite | Level 6

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.

 

1 REPLY 1
tomrvincent
Rhodochrosite | Level 12
I don't see location mentioned anywhere...

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 575 views
  • 0 likes
  • 2 in conversation