BookmarkSubscribeRSS Feed
Aman4SAS
Obsidian | Level 7

Hi ,

i am facing problem to create excel file with multisheet in my new PC. using sas 9.3 - 64 bit

using code is below:

%macro test(nm);
99   proc export data=dw.sas_report_brand_map(where =(index(upcase(REPORT_BRAND_DESCR),"&nm")>0))
100  outfile="Z:\SAS Support\brands.xlsx" dbms=xlsx ;
101  sheet="&nm";
102  run;
103  %mend;
104  %test(xyz);

NOTE: The export data set has 32 observations and 13 variables.
NOTE: "Z:\SAS Support\brands.xlsx" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.14 seconds
      cpu time            0.03 seconds


105  %test(abc);

NOTE: Export cancelled.  Output file Z:\SAS Support\brands.xlsx already exists. Specify REPLACE
      option to overwrite it.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           0.06 seconds
      cpu time            0.01 seconds


i have used with or without replace option, result is differing only that with replace ,
sas creating file with second call macro file. its completly replace previous one.

can any one please suggest me how to resolve this issue.

Thanks

2 REPLIES 2
SASKiwi
PROC Star

What maintenance release in version 9.3 (see the top of your SAS log)? Should be OK from M1 onwards:

51580 - The XLSX engine is enhanced to write multiple sheets per Microsoft Excel file in the first m...

Steelers_In_DC
Barite | Level 11

Here is a template that should work for you:

ods _all_ close;

ods tagsets.ExcelXP path='PATH' file='OUTPUT.xml'

style=printer;

ods tagsets.ExcelXP options(sheet_name='SHEET NAME ONE' AUTOFILTER = 'ALL');

proc print data=FILE1 noobs;

var _all_;run;quit;

ods tagsets.ExcelXP options(sheet_name='SHEET NAME TWO' AUTOFILTER = 'ALL');

proc print data=FILE2 noobs;

var _all_;run;quit;

ods tagsets.ExcelXP close;

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

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
  • 1110 views
  • 0 likes
  • 3 in conversation