<?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: Excel ODS &amp;amp; Export from Unix to Windows in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Excel-ODS-amp-Export-from-Unix-to-Windows/m-p/624927#M184153</link>
    <description>&lt;P&gt;1. Add an ODS EXCEL statement to create the Excel file&lt;/P&gt;
&lt;P&gt;2. In the loop use an ODS EXCEL statement to specify the formatting options you want and the specific sheet name.&lt;/P&gt;
&lt;P&gt;3. Use PROC PRINT/REPORT to export your data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should be all.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your datasets are all the same format with variables and such, you could stack them and use BY group processing so each tab is created automatically and no loops are needed but I have no idea what your reports are supposed to look like or what your data looks like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The process is sketched out below, I have not tested this code and it's likely buggy but should give you the idea to get started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%LET VALRPRTS = TMSHT_VAL_1,TMSHT_VAL_2,TMSHT_VAL_3,TMSHT_VAL_4,TMSHT_VAL_5,TMSHT_VAL_6,TMSHT_VAL_7;

 



%MACRO VALIDATION_REPORTS;

&lt;FONT size="4" color="#FF6600"&gt;&lt;STRONG&gt;ods excel file='path to xlsx file' options(list options that will apply to all sheets here) style=meadow;
*You can also specify your style here;
&lt;/STRONG&gt;&lt;/FONT&gt;
%DO I=1 %TO %SYSFUNC(COUNTW(%BQUOTE(&amp;amp;VALRPRTS),%STR(,)));

 

%LET NXTREPRT = %SCAN(%BQUOTE(&amp;amp;VALRPRTS),&amp;amp;I);

 

/* EXPORT THE RESULTS TO THE SAS GLOBAL DIRECTORY FOLDER */

&lt;FONT size="4" color="#FF6600"&gt;&lt;STRONG&gt;ods excel options(sheet_interval='now' sheet_name = "&amp;amp;nxtreprt."); 
*add options;&lt;/STRONG&gt;&lt;/FONT&gt;


PROC print data=&amp;amp;nxtreprt.;
.....
run;


%END;

&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;ods excel close;&lt;/STRONG&gt;&lt;/FONT&gt;

%MEND VALIDATION_REPORTS;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Feb 2020 19:14:04 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-02-14T19:14:04Z</dc:date>
    <item>
      <title>Excel ODS &amp; Export from Unix to Windows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-ODS-amp-Export-from-Unix-to-Windows/m-p/624914#M184146</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a program that takes7 validation reports and exports them into an xlsx file on my sas unix folder. I didn't include it in here but the but the SAS program then attaches the excel file in an email and sends out to a group. Just a general question - how would I change the program to instead format each tab using SAS ODS to make it look cleaner and then export to a file on my windows directory?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I currently use&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET VALRPRTS = TMSHT_VAL_1,TMSHT_VAL_2,TMSHT_VAL_3,TMSHT_VAL_4,TMSHT_VAL_5,TMSHT_VAL_6,TMSHT_VAL_7;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%MACRO&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM&gt;VALIDATION_REPORTS&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%DO I=&lt;STRONG&gt;1&lt;/STRONG&gt; %TO %SYSFUNC(COUNTW(%BQUOTE(&amp;amp;VALRPRTS),%STR(,)));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET NXTREPRT = %SCAN(%BQUOTE(&amp;amp;VALRPRTS),&amp;amp;I);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* EXPORT THE RESULTS TO THE SAS GLOBAL DIRECTORY FOLDER */&lt;/P&gt;&lt;P&gt;PROC EXPORT&lt;/P&gt;&lt;P&gt;DATA=WORK.&amp;amp;NXTREPRT&lt;/P&gt;&lt;P&gt;OUTFILE="/sas/data/Law_Grp_Risk_Rv/shared/23-Risk_review/2_Libraries/RRGGLBL/RRG_VAL_FNL.XLSX"&lt;/P&gt;&lt;P&gt;DBMS=XLSX REPLACE;&lt;/P&gt;&lt;P&gt;SHEET="&amp;amp;NXTREPRT";&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: navy; background: white;"&gt;%MEND &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&lt;I&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;VALIDATION_REPORTS&lt;/SPAN&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 17:54:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-ODS-amp-Export-from-Unix-to-Windows/m-p/624914#M184146</guid>
      <dc:creator>ElvisK</dc:creator>
      <dc:date>2020-02-14T17:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Excel ODS &amp; Export from Unix to Windows</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Excel-ODS-amp-Export-from-Unix-to-Windows/m-p/624927#M184153</link>
      <description>&lt;P&gt;1. Add an ODS EXCEL statement to create the Excel file&lt;/P&gt;
&lt;P&gt;2. In the loop use an ODS EXCEL statement to specify the formatting options you want and the specific sheet name.&lt;/P&gt;
&lt;P&gt;3. Use PROC PRINT/REPORT to export your data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should be all.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your datasets are all the same format with variables and such, you could stack them and use BY group processing so each tab is created automatically and no loops are needed but I have no idea what your reports are supposed to look like or what your data looks like.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The process is sketched out below, I have not tested this code and it's likely buggy but should give you the idea to get started.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%LET VALRPRTS = TMSHT_VAL_1,TMSHT_VAL_2,TMSHT_VAL_3,TMSHT_VAL_4,TMSHT_VAL_5,TMSHT_VAL_6,TMSHT_VAL_7;

 



%MACRO VALIDATION_REPORTS;

&lt;FONT size="4" color="#FF6600"&gt;&lt;STRONG&gt;ods excel file='path to xlsx file' options(list options that will apply to all sheets here) style=meadow;
*You can also specify your style here;
&lt;/STRONG&gt;&lt;/FONT&gt;
%DO I=1 %TO %SYSFUNC(COUNTW(%BQUOTE(&amp;amp;VALRPRTS),%STR(,)));

 

%LET NXTREPRT = %SCAN(%BQUOTE(&amp;amp;VALRPRTS),&amp;amp;I);

 

/* EXPORT THE RESULTS TO THE SAS GLOBAL DIRECTORY FOLDER */

&lt;FONT size="4" color="#FF6600"&gt;&lt;STRONG&gt;ods excel options(sheet_interval='now' sheet_name = "&amp;amp;nxtreprt."); 
*add options;&lt;/STRONG&gt;&lt;/FONT&gt;


PROC print data=&amp;amp;nxtreprt.;
.....
run;


%END;

&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;ods excel close;&lt;/STRONG&gt;&lt;/FONT&gt;

%MEND VALIDATION_REPORTS;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 19:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Excel-ODS-amp-Export-from-Unix-to-Windows/m-p/624927#M184153</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-14T19:14:04Z</dc:date>
    </item>
  </channel>
</rss>

