BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am trying to input a time value that is given in 00:00:00 (Hour:Minute:Second) Format. I am wondering how I can input this so SAS converts it to all seconds so I can subtract and add the times to eachother. I then need to convert it back to the Hour:Minute:Second time format. Anyone know the imput function command or how I could do this? I am pulling the data from a .csv file. Thanks for any help.
2 REPLIES 2
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
You can use the SAS INPUT function in a DATA step to convert a text-string in the format you mentioned in your post to a SAS numeric variable. When converted, the value will represent seconds, and so then you choose a SAS FORMAT to display your data as needed.

The SAS support website http://support.sas.com/ and its SEARCH facility can provide both documentation and supplemental technical conference topic material.

Scott Barry
SBBWorks, Inc.
deleted_user
Not applicable
Think you need the hhmmss format, which convert the data on which you can perform calculations.

data test;
input time hhmmss8.;
time_5 = time + 5*60;
format time time_5 tod.;
cards;
02:32:41
;
run;
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
  • 954 views
  • 0 likes
  • 2 in conversation