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;
,
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;
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;
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 😉
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.