<?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: creating macro code for exporting different excel with  multiple sheets in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/creating-macro-code-for-exporting-different-excel-with-multiple/m-p/532295#M22311</link>
    <description>Hi:&lt;BR /&gt;  Thanks for sending your code. But without data, no one can run your code without guessing the data structure and making some fake data. And, then if they design the wrong kind of fake data, then your program will not work with the data they make up.&lt;BR /&gt;&lt;BR /&gt;To help us help you, it is very useful to either illustrate your problem using SASHELP data, which everyone has access to or to provide some sample data in the form of a DATA step program that MAKES some test data for us, where the data is in YOUR structure and works with YOUR program.&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
    <pubDate>Sat, 02 Feb 2019 17:08:32 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2019-02-02T17:08:32Z</dc:date>
    <item>
      <title>creating macro code for exporting different excel with  multiple sheets</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/creating-macro-code-for-exporting-different-excel-with-multiple/m-p/532269#M22308</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the scenario,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a macro code that produces xml file for different businesses that will have multiple sheets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Business : Snacks, Diary, Choco and each business has multiple sub cat that comes in the sheets of the xml file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I execute the macro, the output should be three different xml files for each business (Snacks.xml, Diary.xml, Choco.xml) and with the sub cat in their respective sheets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code I created,&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;%MACRO TABLES(INPUT=, OUTPUT1= , OUTPUT2= ,OUTPUT3= ,COND1= , c1= );&lt;BR /&gt;%Local INPUT OUTPUT1 output2 COND c1 c2;&lt;/P&gt;&lt;P&gt;PROC SQL NOPRINT;&lt;BR /&gt;CREATE TABLE &amp;amp;OUTPUT1. AS&lt;BR /&gt;SELECT * FROM &amp;amp;INPUT.&lt;BR /&gt;WHERE &amp;amp;c1="&amp;amp;COND1.";&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;CREATE TABLE &amp;amp;OUTPUT2. AS&lt;BR /&gt;SELECT * FROM &amp;amp;OUTPUT1.&lt;BR /&gt;WHERE country in ('India');&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;BR /&gt;CREATE TABLE &amp;amp;OUTPUT3. AS&lt;BR /&gt;SELECT * FROM &amp;amp;OUTPUT1.&lt;BR /&gt;WHERE country in ('USA');&lt;BR /&gt;QUIT;&lt;/P&gt;&lt;P&gt;%MEND TABLES;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro Export(output1=, input1=, output2=, input2=, output3=, input3=);&lt;/P&gt;&lt;P&gt;ods tagsets.ExcelXP file="/sasconfig/Lev1/External/&amp;amp;file..xml" style=meadow&lt;BR /&gt;options (sheet_name = "&amp;amp;input1.");&lt;BR /&gt;ods results on;&lt;/P&gt;&lt;P&gt;proc report data= &amp;amp;output1.&lt;BR /&gt;style(header)=[background=LightGray font_weight=Bold borderwidth=1] ;&lt;/P&gt;&lt;P&gt;columns a b c d e;&lt;/P&gt;&lt;P&gt;define a /display ;&lt;/P&gt;&lt;P&gt;define b /display ;&lt;/P&gt;&lt;P&gt;define c /display;&lt;/P&gt;&lt;P&gt;define d /display;&lt;/P&gt;&lt;P&gt;define e /display;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods tagsets.Excelxp options(sheet_name = "&amp;amp;input2.");&lt;/P&gt;&lt;P&gt;proc report data= &amp;amp;output2.&lt;BR /&gt;style(header)=[background=LightGray font_weight=Bold borderwidth=1] ;&lt;/P&gt;&lt;P&gt;columns a b c d e;&lt;/P&gt;&lt;P&gt;define a /display ;&lt;/P&gt;&lt;P&gt;define b /display ;&lt;/P&gt;&lt;P&gt;define c /display;&lt;/P&gt;&lt;P&gt;define d /display;&lt;/P&gt;&lt;P&gt;define e /display;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods tagsets.Excelxp options(sheet_name = "&amp;amp;input3.");&lt;/P&gt;&lt;P&gt;proc report data= &amp;amp;output3.&lt;BR /&gt;style(header)=[background=LightGray font_weight=Bold borderwidth=1] ;&lt;/P&gt;&lt;P&gt;columns a b c d e;&lt;/P&gt;&lt;P&gt;define a /display ;&lt;/P&gt;&lt;P&gt;define b /display ;&lt;/P&gt;&lt;P&gt;define c /display;&lt;/P&gt;&lt;P&gt;define d /display;&lt;/P&gt;&lt;P&gt;define e /display;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;ods _all_ close;&lt;BR /&gt;%mend Export;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Export(output1=Snacks_A,output2=Snacks_B, output3=Snacks_C,&lt;BR /&gt;input1=India, input2=USA, input3=Australia);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Export(output1=Choco_A,output2=Choco_B, output3=Choco_C,&lt;BR /&gt;input1=India, input2=USA, input3=Australia);&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Here I am using multiple proc reports for exporting multiple sheets into single business file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The sheets for different businesses varies and max of 6 sheets (country).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to modify the code with a single proc report.&amp;nbsp; Any suggestions are highly appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!!!&lt;/P&gt;&lt;P&gt;Vigneswar&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Feb 2019 07:22:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/creating-macro-code-for-exporting-different-excel-with-multiple/m-p/532269#M22308</guid>
      <dc:creator>Vigneswar</dc:creator>
      <dc:date>2019-02-02T07:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: creating macro code for exporting different excel with  multiple sheets</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/creating-macro-code-for-exporting-different-excel-with-multiple/m-p/532295#M22311</link>
      <description>Hi:&lt;BR /&gt;  Thanks for sending your code. But without data, no one can run your code without guessing the data structure and making some fake data. And, then if they design the wrong kind of fake data, then your program will not work with the data they make up.&lt;BR /&gt;&lt;BR /&gt;To help us help you, it is very useful to either illustrate your problem using SASHELP data, which everyone has access to or to provide some sample data in the form of a DATA step program that MAKES some test data for us, where the data is in YOUR structure and works with YOUR program.&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Sat, 02 Feb 2019 17:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/creating-macro-code-for-exporting-different-excel-with-multiple/m-p/532295#M22311</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-02-02T17:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: creating macro code for exporting different excel with  multiple sheets</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/creating-macro-code-for-exporting-different-excel-with-multiple/m-p/532307#M22313</link>
      <description>And when posting the code, please use the code snippet as it makes it much easier to read/use the code.</description>
      <pubDate>Sat, 02 Feb 2019 18:09:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/creating-macro-code-for-exporting-different-excel-with-multiple/m-p/532307#M22313</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-02T18:09:40Z</dc:date>
    </item>
  </channel>
</rss>

