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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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