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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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