proc import datafile ='c:\Users\xxxxx\Desktop\timezone.xlsx'
out=data
dbms=xlsx ;
run;
data ds;
set data;
time_difference=intck('Hour', India,Florida);
format India Florida time5.;
proc print;
run;
Is there a question somewhere in your posting?
I want time difference
If you want to compare times across different days you need to take the day into account.
data have;
infile cards dsd truncover ;
input (time1 time2) (:time12.);
format time1-time2 tod5.;
cards;
12:00 AM,2:30 PM
1:00 AM,3:30 PM
2:00 AM,4:30 PM
3:00 AM,5:30 PM
4:00 AM,6:30 PM
5:00 AM,7:30 PM
6:00 AM,8:30 PM
7:00 AM,9:30 PM
8:00 AM,10:30 PM
9:00 AM,11:30 PM
10:00 AM,12:30 AM
11:00 AM,1:30 AM
12:00 PM,2:30 AM
1:00 PM,3:30 AM
2:00 PM,4:30 AM
3:00 PM,5:30 AM
4:00 PM,6:30 AM
5:00 PM,7:30 AM
6:00 PM,8:30 AM
7:00 PM,9:30 AM
8:00 PM,10:30 AM
9:00 PM,11:30 AM
10:00 PM,12:30 PM
11:00 PM,1:30 PM
;
data want ;
set have ;
seconds = dhms(time2<time1,0,0,time2)-time1 ;
hours = seconds / '01:00't;
format seconds tod5.;
run;
proc print;
run;
Obs time1 time2 seconds hours 1 00:00 14:30 14:30 14.5 2 01:00 15:30 14:30 14.5 3 02:00 16:30 14:30 14.5 4 03:00 17:30 14:30 14.5 5 04:00 18:30 14:30 14.5 6 05:00 19:30 14:30 14.5 7 06:00 20:30 14:30 14.5 8 07:00 21:30 14:30 14.5 9 08:00 22:30 14:30 14.5 10 09:00 23:30 14:30 14.5 11 10:00 00:30 14:30 14.5 12 11:00 01:30 14:30 14.5 13 12:00 02:30 14:30 14.5 14 13:00 03:30 14:30 14.5 15 14:00 04:30 14:30 14.5 16 15:00 05:30 14:30 14.5 17 16:00 06:30 14:30 14.5 18 17:00 07:30 14:30 14.5 19 18:00 08:30 14:30 14.5 20 19:00 09:30 14:30 14.5 21 20:00 10:30 14:30 14.5 22 21:00 11:30 14:30 14.5 23 22:00 12:30 14:30 14.5 24 23:00 13:30 14:30 14.5
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.