DATA Step, Macro, Functions and more

Date Time format issues

Reply
Occasional Contributor
Posts: 9

Date Time format issues

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?

PROC Star
Posts: 8,145

Re: Date Time format issues

Posted in reply to apxprdtr10

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

 

Occasional Contributor
Posts: 9

Re: Date Time format issues

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.

Super User
Posts: 13,293

Re: Date Time format issues

Posted in reply to apxprdtr10

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;
Ask a Question
Discussion stats
  • 3 replies
  • 88 views
  • 0 likes
  • 3 in conversation