BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
seltonsy
Quartz | Level 8

Hi there

 

I'm trying to import xlsx file using sas studio (see program below), but the mixed, scantext, scantime etc do not work. it used to work flawlessly in sas enterprise and 9.4.

 

now all my variables are messed up, numeric changed to characters. is there a way to work this instead of changing the format of each variable. 

 

 

FILENAME REFFILE '/folders/myfolders/sasuser.v94/1234.xlsx';

PROC IMPORT DATAFILE=REFFILE
DBMS=XLSX
OUT=WORK.projet;
GETNAMES=YES;
mixed=yes;
scantext=yes;
scantime=yes;
RUN;

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I'm assuming you weren't using DBMS=XLSX when you used this code 'flawlessly'?

 

They are different engines.  I'm assuming you're using SAS UE?

 

My guess would be to try the LIBNAME

 

libname dataIn xlsx 'path to file';

You could try other engines in your import, but may be stuck converting it to CSV anyways. If you haven't already, you'll soon hear that you shouldn't use Excel because it doesn't have defined types. Expecting a system to correctly guess all the types is a big assumption and task, and many workarounds involve converting the file to CSV and then manually specifying your data types and formats. 

View solution in original post

1 REPLY 1
Reeza
Super User

I'm assuming you weren't using DBMS=XLSX when you used this code 'flawlessly'?

 

They are different engines.  I'm assuming you're using SAS UE?

 

My guess would be to try the LIBNAME

 

libname dataIn xlsx 'path to file';

You could try other engines in your import, but may be stuck converting it to CSV anyways. If you haven't already, you'll soon hear that you shouldn't use Excel because it doesn't have defined types. Expecting a system to correctly guess all the types is a big assumption and task, and many workarounds involve converting the file to CSV and then manually specifying your data types and formats. 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2022 views
  • 0 likes
  • 2 in conversation