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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 695 views
  • 0 likes
  • 3 in conversation