SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

libname excel - is this really an excel 97 file?

New Contributor
Posts: 2

libname excel - is this really an excel 97 file?

I am working with SAS 9.1.3 for windows and am using SAS to create an Excel workbook with several worksheets using -

libname myxl excel path=""

My excel file is then to be read in by a java application which is looking for an excel 97 workbook.

Unfortunately the java application cannot read the xls file created by my SAS code. However, if I open the xls file in excel and then save it as an excel 97 file then my java application has no trouble reading it. I also notice that when I do this the size of the file roughly doubles.

Is SAS really creating an excel file when I use the above libname statement or just something that can be read by Excel 97 ?
Is there anything I can do to create a proper excel 97 file from SAS ?

Many thanks in advance for any help.
Posts: 9,036

Re: libname excel - is this really an excel 97 file?

It says here the the default value for the LIBNAME Engine is 97:
in the discussion of the VERSION= option.

But that is the 9.2 documentation. I don't know whether it was different in SAS 9.1.3. You might wish to check with Tech Support on that question.

You could also just try an explicit VERSION= option.
libname myxl excel "c:\temp\mywb.xls" version=97;

I never use the PATH= option on Windows, which is why I didn't show it above. I most often see it used when creating Excel files on UNIX and using PATH=, PORT= and USER= to connect to a Windows server. As described here:

New Contributor
Posts: 2

Re: libname excel - is this really an excel 97 file?

Posted in reply to Cynthia_sas
I've tried VER=97 and it makes no difference - the file is still smaller than when I open it in excel and resave as excel 97 and it still can't be read by the java app.

As a quick fix I've now used DDE to get SAS to use excel to open and resave in excel 97 format. It does the job but isn't ideal.

All the reading I have done seams to suggest that libname excel should create proper xls files whereas other methods just create something like HTML that can be read by excel. However there is definitely something odd going on.
Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation