BookmarkSubscribeRSS Feed
Obsidian | Level 7

Hey I have a question about how I can batch a folder with several xls files into xlsx. I am using SAS grid 9.4.


Super User Tom
Super User

Why?  Where they accidentally named with the wrong extension?


Note that changing the extension on a file's name will not change the content or format of the file.

Obsidian | Level 7

Due to being on the grid our new can only read in xlsx files and not xls.

Super User Tom
Super User

The same code that can read XLSX files should be able to read XLS files with only a small modification.

Can you show an example where it doesn't work?

Perhaps you just need to update your version of SAS to something that was released in the last 18 months?


If your SAS cannot read the XLS files then you cannot use SAS to convert them to XLSX.  You will need to use Excel or some other tool.

Super User

You need to CONVERT those files. RENAMING them does NOTHING to help you.

.xls and .xlsx files have a completely different structure. .xls need a specific, Microsoft-supplied, Windows-only module to read them, while .xlsx is (for Microsoft standards) well documented and has therefore enabled SAS to come up with platform-independent code for reading them.

Open the files in Excel, save them as xlsx, and then put them onto the SAS server.


But you are very well advised to immediately convert to csv (a texual file format) and read that with a custom data step, so you have control over the structure (Excel file always involve guessing about structure on the part of SAS). Working with Excel-derived data directly always turns out to be a major PITA.

Meteorite | Level 14

Do you have SAS 9.4 x64 and does not communicate with Office x32. Then possible solutions are:

1) Save your files in other format than xls or xlsx. I suggest CSV and you can use VBA code to convert the files to CSV.

2)  Install SAS PC Server Files on your computer.


Diamond | Level 26 RW9
Diamond | Level 26

You mistake the file format.  A file's extension tells the operating system what program to use to open a file.  Changing this will not change the format.

XLS is a proprietary binary Excel format from years ago.

XLSX is a zipped file contain some folders and xml files.

If you change the file extension from one to the other this will not change the internal file, Excel may be ok loading it (as it can read both quite happily), but for your purposes it will not work.

If you are using a non-windows system or your bit does not match, then you will have a lot of issues trying to load the data.  

A simple method is to write a small Excel VBA script which opens each XLS file and saves them to a portable far more usable format like CSV or XML.  You can then write good robust code to read in these text files on any system,  at anytime in the future regardless of OS or software.



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
  • 6 replies
  • 5 in conversation