BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ronein
Onyx | Level 15

Hello

I want to ask about time data.

I have raw data with  Hours:Minutes,Seconds .

For example  00:15:00  (means 0 hours 15 minutes 0 seconds)

For example  12:00:00 (means 12 hours ,0 minutes,0 seconds)

For example  01:02:00(means 1 hour 2 minutes 0 seconds)

The task-I want to retrieve all observations with more then 30 minutes.

 

DATA a;
  input  wt_time time8.;
  DATALINES;
00:01:00
00:31:00
12:00:00
00:00:00
01:02:00
  ;
RUN;

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Like this?

 

DATA a;
  input  wt_time time8.;
  format wt_time time8.;
  DATALINES;
00:01:00
00:31:00
12:00:00
00:00:00
01:02:00
  ;
RUN;

data b;
    set a;
    where wt_time ge '00:30:00't;
run;

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Like this?

 

DATA a;
  input  wt_time time8.;
  format wt_time time8.;
  DATALINES;
00:01:00
00:31:00
12:00:00
00:00:00
01:02:00
  ;
RUN;

data b;
    set a;
    where wt_time ge '00:30:00't;
run;
Kurt_Bremser
Super User

If you need to extract the minutes from a time value, There Is a Function for It (Maxim 9).

Go to SAS® 9.4 and SAS® Viya® 3.4 Programming Documentation, navigate to Data Step Programming / Functions and Call Routines / Functions and Call Routines / Dictionary of Functions and Call Routines and see if you find something with minutes 😉

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 823 views
  • 1 like
  • 3 in conversation