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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 1209 views
  • 0 likes
  • 4 in conversation