BookmarkSubscribeRSS Feed
Belle
Obsidian | Level 7

Hi members,

I am running SAS EG4.3 on the server, and trying to create an excel file with multiple tab in it, and then send this file to myself; however, I keep getting an error saying "ERROR: DBMS type XLSX not valid for export.", I did some research, but tried several suggestions online, but it still doesn't work.

Do I need to create an Excel file before I attach in the mail?

Please help.

Thank you!

/*** output an Excel with multiple tab ***/

data &server..test2;

   set &server..test;

run;

proc export data = &server..test

   outfile = "c:/sas/test"

   dbms = excel replace;

   sheet = check1;

run;

proc export data = &server..test2

   outfile = "c:/sas/test"

   dbms = excel replace;

   sheet = check2;

run;

ERROR: DBMS type EXCEL not valid for export.

/*** sent an email ***/

data _null_;

file sendit email

to='email.com'

subject='Demo Results'

attach=('&server..test2.xls'

  content_type="application/excel"

);

RUN;

ERROR: Error opening attachment file test2.xls.

ERROR: Physical file does not exist, server..test2.xls.

Please let me know if you need more information. Thanks

4 REPLIES 4
Reeza
Super User

Have you tried explicitly writing your file name in the outfile?

EG 4.3 probably cant create XLSX file as it was too old at the time.

c:\temp\test.xls

ChrisHemedinger
Community Manager

For DBMS=EXCEL to work, you need to have SAS/ACCESS to PC Files licensed and installed in your SAS environment.  It appears that you don't have that.

The alternative for SAS 9.2 is to use ODS tagsets.ExcelXP,  which creates an Excel-compatible XML file.  For SAS 9.4 users, you can use ODS EXCEL to create an XLSX file directly.  Both of these methods work in Base SAS.

You can also export to CSV and attach that in your e-mail.  It's a simple file format that opens in Excel, but you won't have the control over multiple sheets that you're looking for.  You would have to export multiple CSV files.

Chris

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
Belle
Obsidian | Level 7

Thanks Reeza and Chris. It seems like this is very complicated.

I think I'm going to find a workaround and export as csv / xslx files as part of the process flow.

btw...my final goal is to fit the final report template, I can use EED to read in.

Ksharp
Super User

Libname statement is a good choice .


libname x excel 'c:\temp\multi.xls';

data a_20150101 a_20150204 a_20150903;
   set sashelp.class;
   run;

proc copy in=work out=x memtype=data ;run;

libname x clear; 

Xia Keshan

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 4 replies
  • 2928 views
  • 1 like
  • 4 in conversation