<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Generate single excel file by calling multiple macros using proc print in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398209#M19413</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I am not sure why you are getting that error. It is generally the type of error you get when you violate some Spreadsheet Markup Language rule that Microsoft set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I made a slightly different version of your program, using SASHELP datasets and changed the macro program to use keyword parameters because I don't like positional parameters and I cleaned up the %IF statements and used &amp;amp;TYPE for the sheet_name and the Excel file opened correctly for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's the code I tried. Note that I used the correct file extension of .XML for this output (instead of .XLS). I used the TAGSETS.EXCELXP version:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: This is the Excel XP tagset (Compatible with SAS 9.1.3 and above, v1.131, 04/23/2015). Add&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;options(doc='help') to the ods statement for more information.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I ran this on a SAS 9.4 M3 system on Windows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you try my code and get the same Workbook error on open, then I recommend that you open a track with Tech Support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro ods_rpt(type=);

%if &amp;amp;type.= A %then %do;

%let want=sashelp.class;

ods tagsets.excelxp file="c:\temp\Test_Audit_Report.xml"  style=Printer;

%end;
%else %if &amp;amp;type = B %then %do;
  %let want=sashelp.shoes;
%end;
%else %if &amp;amp;type = C %then %do;
  %let want=sashelp.heart;
%end;

ods tagsets.excelxp options(embedded_titles='yes'
page_order_across='Yes'
orientation = 'Landscape'
suppress_bylines='Yes'
sheet_name="&amp;amp;type"
frozen_headers='yes'
frozen_rowheaders='2'
column_repeat='1-2'
FitToPage='yes'
autofit_height='yes'
sheet_label=' '
);

proc print data=&amp;amp;want (obs=3);
title "Type: &amp;amp;type is reporting on &amp;amp;want";
run;
title;

 

%if &amp;amp;type.= C %then %do;

ods _all_ close ;

   %put Begin==========&amp;gt; TYPE value is &amp;amp;type last dataset is &amp;amp;want;
   %put I do not issue unix commands on Windows;
   %put So this is something in the log;
   %put instead of the original unix commands;
   %put End ==========&amp;gt;;
%end;

%mend ods_rpt;

%ods_rpt(type=A)

%ods_rpt(type=B)

%ods_rpt(type=C)&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Sep 2017 19:08:20 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2017-09-22T19:08:20Z</dc:date>
    <item>
      <title>Generate single excel file by calling multiple macros using proc print</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398057#M19404</link>
      <description>&lt;P&gt;HI Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have one scenario and looks simple only. I am able to genearte excel file but it's not opening and saying that errors in excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i have code similar like below. file is generating but with errors and not opening.&lt;/P&gt;&lt;P&gt;Please suggest me whetehr below way is correct or not.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro ods_rpt(type);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%if &amp;amp;type.= A %then %do;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp file="/Sales/reports/Audit_Report.xls" &amp;nbsp;style=Printer;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;ods tagsets.excelxp options(embedded_titles='yes'&lt;BR /&gt;page_order_across='Yes'&lt;BR /&gt;orientation = 'Landscape'&lt;BR /&gt;suppress_bylines='Yes'&lt;BR /&gt;sheet_name='A'&lt;BR /&gt;frozen_headers='yes'&lt;BR /&gt;frozen_rowheaders='2'&lt;BR /&gt;column_repeat='1-2'&lt;BR /&gt;FitToPage='yes'&lt;BR /&gt;autofit_height='yes'&lt;BR /&gt;sheet_label=' '&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;proc print data=sales&amp;amp;type.;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%if &amp;amp;type.= C %then %do;&lt;BR /&gt;&lt;BR /&gt;ods close _all_;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%if &amp;amp;type.= C %then %do;&lt;BR /&gt;x "gzip &lt;SPAN&gt;/Sales/reports/Audit_Report.xls&lt;/SPAN&gt;";&lt;BR /&gt;x "chmod 644 &lt;SPAN&gt;/Sales/reports/Audit_Report.xls&lt;/SPAN&gt;.gz )";&lt;BR /&gt;x uuencode &lt;SPAN&gt;/Sales/reports/Audit_Report.xls.gz /Sales/reports/Audit_Report.xls&lt;/SPAN&gt;.gz | mailx -s "Report output" xxxxx@xxx.com;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%ods_rpt(A)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%ods_rpt(B)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%ods_rp(C)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 11:36:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398057#M19404</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2017-09-22T11:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Generate single excel file by calling multiple macros using proc print</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398082#M19405</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt;I'm not exactly sure what you're doing in your macro programs, but the statement should be &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS _ALL_ CLOSE;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;and not &lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS CLOSE _ALL_;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;as you show in your code.&lt;BR /&gt;&lt;BR /&gt;Next, It would probably be better to redesign your macro. The way I read your macro program, you are making Audit_Report.xls and then immediately zipping it up and doing other things with it in one macro call. &lt;BR /&gt;&lt;BR /&gt;It appears that you are trying to use &amp;amp;type to control the flow of the code that gets generated. I do not see any code for &amp;amp;TYPE=B and you didn't show your SAS log or errors, so it's hard to make constructive suggestions.&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 13:01:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398082#M19405</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-09-22T13:01:56Z</dc:date>
    </item>
    <item>
      <title>Re: Generate single excel file by calling multiple macros using proc print</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398091#M19407</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your quick response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see my response below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Yes. Typo mistake. I used ODS _all_ Close;&lt;/P&gt;&lt;P&gt;2. The main purpose of this report is have 3 sas tables salesA,salesB and salesC. I needs to genearte one excel file with 3 sheets.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; These 3tables geneartes individually by calling same macro with diff parameters.(Just imazine)&lt;/P&gt;&lt;P&gt;1. &amp;nbsp; %ods_rpt(A) --&amp;gt; when passing A&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. define Excel file name&lt;/P&gt;&lt;P&gt;2. define filebody and sheet name and print data using PRINT statement in sheet name 'A'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. &amp;nbsp; %ods_rpt(A) --&amp;gt; when passing B&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1. define filebody and sheet name and print data using PRINT statement in sheet name 'B'.(Not defining file name. If defines again file may replace but I need all sheets in single excel file. So I used %if statement to avoid few steps).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3.&amp;nbsp; %ods_rpt(A) --&amp;gt; when passing C&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1.&amp;nbsp;define filebody and sheet name and print data using PRINT statement in sheet name 'C'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2. ODS _all_ Close;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. Generated excel file making as zip file and sending to the team.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3. No erros in log. Fiel is genearting well and also zipping well.but while opening the excel file getting an error. please the attached file which contains error screen shot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please let me know if you have any confusion.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 13:27:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398091#M19407</guid>
      <dc:creator>Banu</dc:creator>
      <dc:date>2017-09-22T13:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Generate single excel file by calling multiple macros using proc print</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398117#M19410</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134610"&gt;@Banu&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your quick response.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please see my response below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Yes. Typo mistake. I used ODS _all_ Close;&lt;/P&gt;
&lt;P&gt;2. &amp;nbsp; %ods_rpt(A) --&amp;gt; when passing B&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. define filebody and sheet name and print data using PRINT statement in sheet name 'B'.(Not defining file name. If defines again file may replace but I need all sheets in single excel file. So I used %if statement to avoid few steps).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;%ods_rpt(A) --&amp;gt; when passing B (besides being poor documentation should be %ods_rpt(B)&lt;/P&gt;
&lt;P&gt;Note that you assign the SAME SHEET NAME regardless if A, B or C&lt;/P&gt;
&lt;PRE&gt;ods tagsets.excelxp options(embedded_titles='yes'
page_order_across='Yes'
orientation = 'Landscape'
suppress_bylines='Yes'
&lt;FONT color="#ff0000" size="4"&gt;&lt;STRONG&gt;sheet_name='A'&lt;/STRONG&gt;&lt;/FONT&gt;
frozen_headers='yes'
frozen_rowheaders='2'
column_repeat='1-2'
FitToPage='yes'
autofit_height='yes'
sheet_label=' '
);&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Sep 2017 14:43:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398117#M19410</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-22T14:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Generate single excel file by calling multiple macros using proc print</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398121#M19411</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;file is generating but with errors and not opening.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;What error are you getting?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ODS TAGSETS.EXCELXP does not generate a native XLSX/XLS file, it generates an XML file so you'll get a &lt;STRONG&gt;warning&lt;/STRONG&gt; when you open the XML file, but you should still be able to open the file. There is no way around this that I know.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Sep 2017 14:49:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398121#M19411</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-22T14:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: Generate single excel file by calling multiple macros using proc print</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398209#M19413</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I am not sure why you are getting that error. It is generally the type of error you get when you violate some Spreadsheet Markup Language rule that Microsoft set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; I made a slightly different version of your program, using SASHELP datasets and changed the macro program to use keyword parameters because I don't like positional parameters and I cleaned up the %IF statements and used &amp;amp;TYPE for the sheet_name and the Excel file opened correctly for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's the code I tried. Note that I used the correct file extension of .XML for this output (instead of .XLS). I used the TAGSETS.EXCELXP version:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;NOTE: This is the Excel XP tagset (Compatible with SAS 9.1.3 and above, v1.131, 04/23/2015). Add&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;options(doc='help') to the ods statement for more information.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I ran this on a SAS 9.4 M3 system on Windows.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you try my code and get the same Workbook error on open, then I recommend that you open a track with Tech Support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro ods_rpt(type=);

%if &amp;amp;type.= A %then %do;

%let want=sashelp.class;

ods tagsets.excelxp file="c:\temp\Test_Audit_Report.xml"  style=Printer;

%end;
%else %if &amp;amp;type = B %then %do;
  %let want=sashelp.shoes;
%end;
%else %if &amp;amp;type = C %then %do;
  %let want=sashelp.heart;
%end;

ods tagsets.excelxp options(embedded_titles='yes'
page_order_across='Yes'
orientation = 'Landscape'
suppress_bylines='Yes'
sheet_name="&amp;amp;type"
frozen_headers='yes'
frozen_rowheaders='2'
column_repeat='1-2'
FitToPage='yes'
autofit_height='yes'
sheet_label=' '
);

proc print data=&amp;amp;want (obs=3);
title "Type: &amp;amp;type is reporting on &amp;amp;want";
run;
title;

 

%if &amp;amp;type.= C %then %do;

ods _all_ close ;

   %put Begin==========&amp;gt; TYPE value is &amp;amp;type last dataset is &amp;amp;want;
   %put I do not issue unix commands on Windows;
   %put So this is something in the log;
   %put instead of the original unix commands;
   %put End ==========&amp;gt;;
%end;

%mend ods_rpt;

%ods_rpt(type=A)

%ods_rpt(type=B)

%ods_rpt(type=C)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Sep 2017 19:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398209#M19413</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-09-22T19:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Generate single excel file by calling multiple macros using proc print</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398253#M19414</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
...
&lt;P&gt;&amp;nbsp;... and changed the macro program to use keyword parameters because I don't like positional parameters&amp;nbsp;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13549"&gt;@Cynthia_sas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;One of the nicer features of SAS macros is that you can call a macro using named parameters even for parameters that were defined as positional. So there is no need to modify the macro definition to use the names in the macro call.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro transform(in,out);
....
%mend transform ;

%transform(out=want,in=have);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Sep 2017 01:58:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398253#M19414</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-23T01:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Generate single excel file by calling multiple macros using proc print</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398254#M19415</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does it work if you transfer the file in some other way and test it?&lt;/P&gt;
&lt;P&gt;Does it work if you delay running the gzip/email step? &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I find it helps a lot to use a data step with an INFILE statement with PIPE option to run OS commands so that any messages are returned to the data step. &amp;nbsp;I also noticed that you did not properly quote the subject line in your mailx command because of nested quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro ods_rpt(type);
%local fname email;
%let fname=/Sales/reports/Audit_Report.xls ;
%let email=xxxxx@xxx.com;

%if &amp;amp;type.= A %then %do;
ods tagsets.excelxp file="&amp;amp;fname"  style=Printer
options
(embedded_titles='yes'
 page_order_across='Yes'
 orientation = 'Landscape'
 suppress_bylines='Yes'
 frozen_headers='yes'
 frozen_rowheaders='2'
 column_repeat='1-2' 
 FitToPage='yes'
 autofit_height='yes'
 sheet_label=' '
);
%end;

ods tagsets.excelxp options (sheet_name="&amp;amp;type");

proc print data=sales&amp;amp;type.;
run;
 
%if &amp;amp;type.= C %then %do;
ods  tagsets.excelxp _all_;

data _null_;
  infile 
"gzip &amp;amp;fname
;chmod 644 &amp;amp;fname..gz 
;uuencode &amp;amp;fname..gz &amp;amp;fname..gz | mailx -s ""Report output"" &amp;amp;email
" pipe;
  input;
  put _infile_;
run;
%end;
%mend ods_rpt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 23 Sep 2017 02:18:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398254#M19415</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-09-23T02:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: Generate single excel file by calling multiple macros using proc print</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398287#M19416</link>
      <description>&lt;P&gt;Tom, it is true, I could have defined them one way but specified them another to invoke. But I prefer to be consistent and not mix the methods. I find keyword parameters easier to explain in both definition and invocation to new macro users. It's a preference, not the only way. That is the beauty of the Macro Facility -- so much flexibility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2017 12:38:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Generate-single-excel-file-by-calling-multiple-macros-using-proc/m-p/398287#M19416</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-09-23T12:38:56Z</dc:date>
    </item>
  </channel>
</rss>

