BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
I'm trying to run a query to check the SourceTime format (15JUL2009:16:12:07) is after 16:00 then create new column as AdjustedTime (16JUL2009:10:00:00), else AdjustedTime=SourceTime.

Appreciate for your assistance.

Thanks,
31 REPLIES 31
Flip
Fluorite | Level 6
look at the TIMEPART() function
Flip
Fluorite | Level 6
look at the TIMEPART() function
Flip
Fluorite | Level 6
look at the TIMEPART() function
Doc_Duke
Rhodochrosite | Level 12
Look at the documentation for the TIMEPART function. The CASE clause will allow you to do the decision breaks.

Something like
timepart(sourcetime) > '16:00:00'T
will establish the criteria.
Doc_Duke
Rhodochrosite | Level 12
Look at the documentation for the TIMEPART function. The CASE clause will allow you to do the decision breaks.

Something like
timepart(sourcetime) > '16:00:00'T
will establish the criteria.
Doc_Duke
Rhodochrosite | Level 12
Look at the documentation for the TIMEPART function. The CASE clause will allow you to do the decision breaks.

Something like
timepart(sourcetime) > '16:00:00'T
will establish the criteria.
Doc_Duke
Rhodochrosite | Level 12
Look at the documentation for the TIMEPART function. The CASE clause will allow you to do the decision breaks.

Something like
timepart(sourcetime) > '16:00:00'T
will establish the criteria.
Doc_Duke
Rhodochrosite | Level 12
Look at the documentation for the TIMEPART function. The CASE clause will allow you to do the decision breaks.

Something like
timepart(sourcetime) GT '16:00:00'T
will establish the criteria.
milts
Pyrite | Level 9
Hi hope this is the solution you're looking for

proc sql;

select
case when
timepart(sourcetime) > '16:00:00't then
input(put(datepart(sourcetime)+1,date9.) || ' ' || '10:00:00',datetime.)
else
sourcetime
end
as adjustedtime format = datetime.
from table

quit;

There are probably other ways but this is the one that i came up with

Regards,
Milton
milts
Pyrite | Level 9
Hi hope this is the solution you're looking for

proc sql;

select
case when
timepart(sourcetime) > '16:00:00't then
input(put(datepart(sourcetime)+1,date9.) || ' ' || '10:00:00',datetime.)
else
sourcetime
end
as adjustedtime format = datetime.
from table

quit;

There are probably other ways but this is the one that i came up with

Regards,
Milton
milts
Pyrite | Level 9
Hi hope this is the solution you're looking for

proc sql;

select
case when
timepart(sourcetime) > '16:00:00't then
input(put(datepart(sourcetime)+1,date9.) || ' ' || '10:00:00',datetime.)
else
sourcetime
end
as adjustedtime format = datetime.
from table

quit;

There are probably other ways but this is the one that i came up with

Regards,
Milton
milts
Pyrite | Level 9
Hi hope this is the solution you're looking for

proc sql;

select
case when
timepart(sourcetime) > '16:00:00't then
input(put(datepart(sourcetime)+1,date9.) || ' ' || '10:00:00',datetime.)
else
sourcetime
end
as adjustedtime format = datetime.
from table

quit;

There are probably other ways but this is the one that i came up with

Regards,
Milton
milts
Pyrite | Level 9
Hi hope this is the solution you're looking for

proc sql;

select
case when
timepart(sourcetime) > '16:00:00't then
input(put(datepart(sourcetime)+1,date9.) || ' ' || '10:00:00',datetime.)
else
sourcetime
end
as adjustedtime format = datetime.
from table

quit;

There are probably other ways but this is the one that i came up with

Regards,
Milton
milts
Pyrite | Level 9
Hi hope this is the solution you're looking for

proc sql;

select
case when
timepart(sourcetime) > '16:00:00't then
input(put(datepart(sourcetime)+1,date9.) || ' ' || '10:00:00',datetime.)
else
sourcetime
end
as adjustedtime format = datetime.
from table

quit;

There are probably other ways but this is the one that i came up with

Regards,
Milton

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 31 replies
  • 1147 views
  • 0 likes
  • 4 in conversation