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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1531 views
  • 0 likes
  • 3 in conversation