BookmarkSubscribeRSS Feed
sbunny364
Fluorite | Level 6

experts,

 

here is my time variable looks like

 

8:42:00

13:07:00

12:30:00


i am importing the excel file and converting to sas datasets using proc import and some how sas is displaying as 30DEC1899 in most of the observations and few other dates. 

 

here is my code

 

proc import datafile="location."
out=outlocation
dbms=excel replace;

getnames=yes;
mixed=no;
scantext=yes;
usedate=yes;
scantime=yes;
quit;

 

i want to read the excel file time variable into sas exactly as i pasted above and the file is .xls format (2016 excel).

 

thank you

sunny

4 REPLIES 4
Reeza
Super User

Did Excel revert back to XLS in 2016? 

 

 

Try removing the Usedate option unless you need it. Ensure the variable has the correct format in SAS - proc import guesses - and not always correctly. 

A SAS time is number of seconds, so without a format it should appear as an integer. 

sbunny364
Fluorite | Level 6
I have converted .xlsx to .xls

Will try as per your suggestion

Thanks much
Reeza
Super User

@sbunny364 wrote:
I have converted .xlsx to .xls

Will try as per your suggestion

Thanks much

Why? Try the XLSX file using DBMS=XLSX

 

If the file is XLS its Excel 95-ish not Excel 2016.

sbunny364
Fluorite | Level 6

it looks like in the excel ...one of the values is being entered as date and the rest are time ...so SAS is reading all the values  as date ...just figured it...

 

thank you reeza

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
  • 4 replies
  • 894 views
  • 1 like
  • 2 in conversation