DATA Step, Macro, Functions and more

Adding minutes to time field and comparing

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Adding minutes to time field and comparing

I wanted to know if the CENT_TM10 is greater than (COLL_TM1 + 15 minutes)

Data EC02;Set Ec01;

if cent_tm10 > coll_tm1 + 15 ;

Run;

I get all the records in EC01 again into EC02..

Any help..

Bob


Accepted Solutions
Solution
‎10-13-2011 10:04 AM
Super User
Super User
Posts: 6,502

Re: Adding minutes to time field and comparing

SAS stores time in seconds. Use 15*60 to get 15 minutes.

View solution in original post


All Replies
PROC Star
Posts: 7,363

Adding minutes to time field and comparing

You didn't indicate what kind of fields cent_tm10 and coll_tm1 were.  If they are datatime fields they are measured in seconds thus you would have to change your comparison to that unit of measurement (i.e., times 60).

Occasional Contributor
Posts: 7

Adding minutes to time field and comparing

time5. is the format that I have on all the time fields.

BOB

Solution
‎10-13-2011 10:04 AM
Super User
Super User
Posts: 6,502

Re: Adding minutes to time field and comparing

SAS stores time in seconds. Use 15*60 to get 15 minutes.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 149 views
  • 3 likes
  • 3 in conversation