BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ammarhm
Lapis Lazuli | Level 10

Hi all

I have a problem importing an excel file, specifically related to a column which is time and another which is datetime

I am trying to import an excel file using proc import:

 


PROC IMPORT OUT= Data
            DATAFILE= "c:\Home\Desktop\data.xlsx"
            DBMS=EXCEL REPLACE ;
GETNAMES=YES;
MIXED=yes;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
Sheet='Sheet1';
RUN;

Which works well, and the file is imported. However, the colums which are in time format in the excel file (yes, formated corectly in the excel file) are imported as date. Same thing happening with columns that are datetime in the excel file

Even if i try to set the data to a new set and force a format on these columns, it dosent work:

 


data Data2;
set Data;
format op_date_time datetime21.;
format op_time time8.;

run;

I guess one way to solve this is importing excel files using libname solution. But is there a way with proc import to instruct SAS to the time/datetime nature of some of the columns

Kind regards

Am

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Not within PROC IMPORT but within a libname you can use DBSASTYPE. 

 

Try the XLSX engine if that's an option, available is SAS 9.3+

View solution in original post

1 REPLY 1
Reeza
Super User

Not within PROC IMPORT but within a libname you can use DBSASTYPE. 

 

Try the XLSX engine if that's an option, available is SAS 9.3+

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1 reply
  • 3637 views
  • 0 likes
  • 2 in conversation