<?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 to XLSX in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/770201#M244333</link>
    <description>&lt;P&gt;OK. Just add one more PROC SORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

proc sort data=sashelp.cars(where=(Type in('Sports' 'Sedan'))) out=temp;by type;run;
ods excel options(sheet_name='Sports/Sedan  Cars' sheet_interval='none');
/***Export to another sheet called 'Sports_Sedan cars'***/
/***with separate table for Sports and Sedan ***/
Title 'Sports/Sedan cars';
proc print data=temp noobs;
by type ;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 Sep 2021 11:44:54 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-09-24T11:44:54Z</dc:date>
    <item>
      <title>Export to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/769854#M244139</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I want to export from SAS to Excel&amp;nbsp; in the following way:&lt;/P&gt;
&lt;P&gt;One sheet for Males&amp;nbsp;(source data sashelp.class)&lt;/P&gt;
&lt;P&gt;One sheet for Females (source data sashelp.class)&lt;/P&gt;
&lt;P&gt;One sheet for Acura Cars ( (Source data&amp;nbsp;sashelp.cars)&lt;/P&gt;
&lt;P&gt;One sheet for Sedan and Sports cars with separate&amp;nbsp; table&amp;nbsp; (Source data&amp;nbsp;sashelp.cars)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May anyone show how to do it please?&lt;/P&gt;
&lt;P&gt;Please note that for sheet male&amp;nbsp; and sheet female I have used&amp;nbsp;sheet_interval='BYGROUP' option.&lt;/P&gt;
&lt;P&gt;The problem is how to add other elements of export&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class;
by sex;
run;
ods excel file= "/path/ReportX.xlsx" 
options(sheet_interval='BYGROUP' sheet_name= '#byval1');
/***Each Sex has a different sheet**/
proc print data=class;
by sex;
run;
 
/***Export to another sheet called 'Acura_Cars'***/
Title 'Acura Cars';
proc print data=sashelp.cars noobs;
where make='Acura';
Run;


/***Export to another sheet called 'Sports_Sedan cars'***/
/***with separate table for Sports and Sedan ***/
Title 'Sports/Sedan cars';
proc print data=sashelp.cars noobs;
where Type in('Sports','Sedan');
Run;
ods excel close;

 
 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 09:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/769854#M244139</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-09-23T09:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: Export to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/769874#M244155</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class;
by sex;
run;


options nobyline;
ods excel file= "c:\temp\ReportX.xlsx" 
options( sheet_name= '#byval1');
/***Each Sex has a different sheet**/
proc print data=class;
by sex;
run;
 
ods excel options(sheet_name='Acura Cars');
/***Export to another sheet called 'Acura_Cars'***/
Title 'Acura Cars';
proc print data=sashelp.cars noobs;
where make='Acura';
Run;


ods excel options(sheet_name='Sports/Sedan  Cars');
/***Export to another sheet called 'Sports_Sedan cars'***/
/***with separate table for Sports and Sedan ***/
Title 'Sports/Sedan cars';
proc print data=sashelp.cars noobs;
where Type in('Sports','Sedan');
Run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or try PROC EXPORT .&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 12:12:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/769874#M244155</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-09-23T12:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Export to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/769905#M244173</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;You wrote :&lt;/P&gt;
&lt;P&gt;I want to have 2 seprate tables in sheet Sports_Sedan_cars.&lt;/P&gt;
&lt;P&gt;In the code that you wrote ,where do you ask to create 2 seprate tables (in same sheet&amp;nbsp;Sports_Sedan_cars)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel options(sheet_name='Sports/Sedan  Cars');
/***Export to another sheet called 'Sports_Sedan cars'***/
/***with separate table for Sports and Sedan ***/
Title 'Sports/Sedan cars';
proc print data=sashelp.cars noobs;
where Type in('Sports','Sedan');
Run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 13:28:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/769905#M244173</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-09-23T13:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Export to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/769915#M244180</link>
      <description>&lt;P&gt;OK. If I understand what you mean .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class out=class;
by sex;
run;


options nobyline;
ods excel file= "c:\temp\ReportX.xlsx" 
options( sheet_name= '#byval1');
/***Each Sex has a different sheet**/
proc print data=class;
by sex;
run;
 
ods excel options(sheet_name='Acura Cars');
/***Export to another sheet called 'Acura_Cars'***/
Title 'Acura Cars';
proc print data=sashelp.cars noobs;
where make='Acura';
Run;


ods excel options(sheet_name='Sports/Sedan  Cars' sheet_interval='none');
/***Export to another sheet called 'Sports_Sedan cars'***/
/***with separate table for Sports and Sedan ***/
Title 'Sports/Sedan cars';
proc print data=sashelp.cars noobs;
where Type in('Sports');
Run;
proc print data=sashelp.cars noobs;
where Type in('Sedan');
Run;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Sep 2021 13:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/769915#M244180</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-09-23T13:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Export to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/770009#M244222</link>
      <description>Thanks again.&lt;BR /&gt;I am looking at the last part of your code and I want to ask if it will.work to add statement BY TYPE in order to get 2 separate tables ( instead of writing 2 proc print statements as you wrote)?&lt;BR /&gt;&lt;BR /&gt;ods excel options(sheet_name='Sports/Sedan  Cars' sheet_interval='none');&lt;BR /&gt;Title 'Sports/Sedan cars';&lt;BR /&gt;proc print data=sashelp.cars noobs;&lt;BR /&gt;where Type in('Sports','Sedan');&lt;BR /&gt;BY TYPE;&lt;BR /&gt;Run;&lt;BR /&gt;ods excel close;</description>
      <pubDate>Thu, 23 Sep 2021 18:54:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/770009#M244222</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2021-09-23T18:54:28Z</dc:date>
    </item>
    <item>
      <title>Re: Export to XLSX</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/770201#M244333</link>
      <description>&lt;P&gt;OK. Just add one more PROC SORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

proc sort data=sashelp.cars(where=(Type in('Sports' 'Sedan'))) out=temp;by type;run;
ods excel options(sheet_name='Sports/Sedan  Cars' sheet_interval='none');
/***Export to another sheet called 'Sports_Sedan cars'***/
/***with separate table for Sports and Sedan ***/
Title 'Sports/Sedan cars';
proc print data=temp noobs;
by type ;
Run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Sep 2021 11:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-to-XLSX/m-p/770201#M244333</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-09-24T11:44:54Z</dc:date>
    </item>
  </channel>
</rss>

