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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

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