BookmarkSubscribeRSS Feed
apxprdtr10
Calcite | Level 5

Hi all,

 

I have time format as 00:01:00 to 24:00:00 in repetition. when i  import the data set i gets automatically converted into some anonymous format. i have 20000 observations and i takes value as same as number of observations. Could anyone tell me why it is happening?

3 REPLIES 3
art297
Opal | Level 21

We'd have to see examples of the data you imported, the code you used, and what you end up getting after importing the data. It's always possible that the import worked correctly and what you're getting are numbers that represent the number of seconds since midnight. If that is the case, you simply need to apply a time format, but your subject line mentions datetime.

 

Art, CEO, AnalystFinder.com

 

apxprdtr10
Calcite | Level 5

I really appreciate your reply and i think you didn't understand my question.

 

Here i once again trying to clear my question.

I am importing a dataset having 'time' variable and format as time.

time

515

620

710

825

1035

 

and now i want this time variable as 

05:15

06:20

07:10

10:35

 

 

 

 

Thanks.

ballardw
Super User

One way assuming the value time is currently numeric:

data want;
   input time  ;
   time = hms(floor(time/100),mod(time,100),0);
   format time tod5.;
datalines;
515
620
710
825
1035
;
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 3 replies
  • 901 views
  • 0 likes
  • 3 in conversation