BookmarkSubscribeRSS Feed
js5
Pyrite | Level 9 js5
Pyrite | Level 9

Dear community,

 

I am having issues importing some excel files using EXCELCS or XLSX engines (only ones available due to bitness differences): as neither XLSX engine nor EXCELCS support MIXED option, if there are any (XLSX) resp. sufficient text values in the first rows (EXCELCS), the entire column gets imported as text. With XLSX engine this additionally leads to dates being saved as internal excel timestamps - number of days since 1 January 1900.

I tried using

 

dbdsopts="dbsastype=(var_mixed=NUMERIC)"

with EXCELCS engine but this does not work - I am getting the following error:

ERROR: During read: [Microsoft][ODBC-Treiber für Excel]Ungültiger Zeichenwert für Konvertierungsangabe. bei Spaltennummer 3 (var_mixed)

It appears that dbsastype option can force the numeric values to be imported as text but not the other way round. Is this a known limitation? Are there any other options? Unfortunately getting the file as .csv is not possible. Thank you!

 

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Excel is a really bad format for data.  Proc import is a really bad way to read data into SAS (as its a guessing procedure).  Add the two together and what you have is GIGO (Garbage In, Garbage Out).

  

Get the data in a usable format like CSV which is open, plain text, cross platform/bitness.

Write a datastep program to correctly read in the CSV file, setting lengths, informats, etc. as you know the data should be (presumably from your data import agreement).

Kurt_Bremser
Super User

It's totally easy to get a csv from the Excel crap. Open in a spreadsheet program of your choice (I recommend OpenOffice or LibreOffice) and save as csv. With proper software, this action can even be scripted from the commandline.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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