<?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: Export in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453590#M114643</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt; wrote:&lt;BR /&gt;Sorry but i dont want to change any code in the proc print or macro .&lt;BR /&gt;I gave this example because in my real problem i have some macros that creating output tables that need to export&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I find results easier to manage if macro definitions and all data manipulation are finished before using the ODS destination for output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a minimum once the data sets are set then minor changes to the output destination code is usually&amp;nbsp;easier to implement (and follow later).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe something like:&lt;/P&gt;
&lt;PRE&gt;%macro print_age(age);
Proc print data = sashelp.class;
   Where age = &amp;amp;age. ;
   title "age : &amp;amp;age." ;
   footnote1 '*Height in CM';
   footnote2 '*Weight in KG';
Run;

PROC SQL;
   create table NoLak as
   select count(*) as No_Lak
   from sashelp.class
   where age = &amp;amp;age.
   ;
QUIT;
proc print data=NoLak noobs;
run;
%mend;

ods tagsets.ExcelXP file="/usr/local/SAS/RON/UserDir/Tbl8.XML"
   style=Printer
   options(sheet_name="Sheet1Ron"
   sheet_interval='NONE'
   embedded_titles='yes'
   embedded_footnotes='yes') 
;

%print_age(13);
ods tagsets.excelxp options(sheet_interval='Proc');
ods tagsets.ExcelXP options(sheet_name="Sheet2Ron" sheet_interval='none');
%print_age(16);
ods tagsets.ExcelXP close;
&lt;/PRE&gt;
&lt;P&gt;note the extra options statement to change the sheet interval option after the first two tables and then reset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interleaving the ods destination sheet/ page type options may be a headache depending on destination and how much you drift from the standard appearances.&lt;/P&gt;</description>
    <pubDate>Thu, 12 Apr 2018 14:53:21 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-04-12T14:53:21Z</dc:date>
    <item>
      <title>Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453541#M114619</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Following code below is creating one excel file with one sheet and 4 tables .&lt;/P&gt;&lt;P&gt;I want to have 2 sheets and each sheet will have 2 tables.&lt;/P&gt;&lt;P&gt;Can anyone fix the code and show how to do it?&lt;/P&gt;&lt;P&gt;I just know to add&amp;nbsp;sheet_interval="none" &amp;nbsp; but when i add it I get &amp;nbsp;4 sheets with 1 table in each sheet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods _all_ close;&lt;BR /&gt;ods tagsets.ExcelXP file="/usr/local/SAS/RON/UserDir/Tbl8.XML"&lt;BR /&gt;style=Printer&lt;BR /&gt;options(sheet_name="Sheet1Ron"&lt;BR /&gt;embedded_titles='yes'&lt;BR /&gt;embedded_footnotes='yes') ;&lt;/P&gt;&lt;P&gt;%macro print_age(age);&lt;BR /&gt;Proc print data = sashelp.class;&lt;BR /&gt;Where age = &amp;amp;age. ;&lt;BR /&gt;title "age : &amp;amp;age." ;&lt;BR /&gt;footnote1 '*Height in CM';&lt;BR /&gt;footnote2 '*Weight in KG';&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;create table NoLak as&lt;BR /&gt;select count(*) as No_Lak&lt;BR /&gt;from sashelp.class&lt;BR /&gt;where age = &amp;amp;age.&lt;BR /&gt;;&lt;BR /&gt;QUIT;&lt;BR /&gt;proc print data=NoLak noobs;run;&lt;BR /&gt;%mend;&lt;BR /&gt;%print_age(13);&lt;BR /&gt;%print_age(16);&lt;BR /&gt;ods tagsets.ExcelXP close;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 13:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453541#M114619</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-04-12T13:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453549#M114624</link>
      <description>&lt;P&gt;If you want multiple tables in an Excel file ... use file= on the first sheet, plus the sheet_name= option; on the second sheet, DO NOT use file= but do use sheet_name=&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 13:36:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453549#M114624</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-04-12T13:36:07Z</dc:date>
    </item>
    <item>
      <title>Re: Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453554#M114626</link>
      <description>&lt;P&gt;As with all programming tasks, macro is not needed and only adds to the complexity.&amp;nbsp; Try (and note how I use the code window - its the {i} above post) to highlight code and retain formatting:&lt;/P&gt;
&lt;PRE&gt;ods tagsets.excelxp file="/usr/local/SAS/RON/UserDir/Tbl8.xml" style=printer
  options(sheet_name="Sheet1Ron" embedded_titles='yes' embedded_footnotes='yes');

data want;
  set sashelp.class;
  where age in (13,16);
run;

proc print data=want;
  by age;
  title "age : #byval1";
  footnote1 '*Height in CM';
  footnote2 '*Weight in KG';
run;

ods tagsets.excelxP close;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 13:50:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453554#M114626</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-12T13:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453557#M114627</link>
      <description>Sorry but i dont want to change any code in the proc print or macro .&lt;BR /&gt;I gave this example because in my real problem i have some macros that creating output tables that need to export</description>
      <pubDate>Thu, 12 Apr 2018 13:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453557#M114627</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-04-12T13:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453590#M114643</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt; wrote:&lt;BR /&gt;Sorry but i dont want to change any code in the proc print or macro .&lt;BR /&gt;I gave this example because in my real problem i have some macros that creating output tables that need to export&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I find results easier to manage if macro definitions and all data manipulation are finished before using the ODS destination for output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a minimum once the data sets are set then minor changes to the output destination code is usually&amp;nbsp;easier to implement (and follow later).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe something like:&lt;/P&gt;
&lt;PRE&gt;%macro print_age(age);
Proc print data = sashelp.class;
   Where age = &amp;amp;age. ;
   title "age : &amp;amp;age." ;
   footnote1 '*Height in CM';
   footnote2 '*Weight in KG';
Run;

PROC SQL;
   create table NoLak as
   select count(*) as No_Lak
   from sashelp.class
   where age = &amp;amp;age.
   ;
QUIT;
proc print data=NoLak noobs;
run;
%mend;

ods tagsets.ExcelXP file="/usr/local/SAS/RON/UserDir/Tbl8.XML"
   style=Printer
   options(sheet_name="Sheet1Ron"
   sheet_interval='NONE'
   embedded_titles='yes'
   embedded_footnotes='yes') 
;

%print_age(13);
ods tagsets.excelxp options(sheet_interval='Proc');
ods tagsets.ExcelXP options(sheet_name="Sheet2Ron" sheet_interval='none');
%print_age(16);
ods tagsets.ExcelXP close;
&lt;/PRE&gt;
&lt;P&gt;note the extra options statement to change the sheet interval option after the first two tables and then reset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interleaving the ods destination sheet/ page type options may be a headache depending on destination and how much you drift from the standard appearances.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Apr 2018 14:53:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export/m-p/453590#M114643</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-04-12T14:53:21Z</dc:date>
    </item>
  </channel>
</rss>

