BookmarkSubscribeRSS Feed
Phamhhm
Fluorite | Level 6

Hi

I have a column in excel, variable : Time with HH:MM

 

I am trying to import in SAS, but my Time variable gives 0.333333....

 

I am trying to convert it :

 

DATA NT;

SET NT;

Time = input(Time, time5.);

FORMAT Time time5.;

RUN;

 

I have a new blank column Time in SAS.

 

Thanks for you answers !

 

 

7 REPLIES 7
Reeza
Super User

Don't use the same data set name in your DATA and SET statement, it makes it really hard to trace your errors. 

 

Can you show what your data looks like before you did your conversion?

Phamhhm
Fluorite | Level 6

Time

Phamhhm
Fluorite | Level 6

Time:  8:00 8:15 8:30 ... 18:00 in Excel

 

 

 

 

Reeza
Super User

What did it look like when you imported the data into SAS?

What was the type and format of the variable?

 

Did you try applying a format rather than doing a conversion?

 

 

Phamhhm
Fluorite | Level 6

Thanks for your help.

problem is solved

Phamhhm
Fluorite | Level 6

PROC IMPORT DATAFILE="\\........\Name.xlsx"

DBMS=xlsx REPLACE OUT=NT;

SHEET='NT';

GETNAMES=YES;

FORMAT Time time5.;

RUN;

 

Ok now...

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