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 😉
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.