<?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: SGplot - macro do loop produce many graphs and output in one excel file with identical sheets' n in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/425906#M14698</link>
    <description>&lt;P&gt;Hi Cynthia,&amp;nbsp;&lt;/P&gt;&lt;P&gt;My earlier reply means I cannot use the following code from you in my macro since I only have one procedure (same procedure for all the sheets) and I don't want to write it 10 times so I guess I can only output 10 different files instead of 10 sheets under same file name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel file='wholeWB.xlsx';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel options(sheet_name="name1");&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;...code for procedure 1 ...;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel options(sheet_name="name2");&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;...code for procedure 2...&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel options(sheet_name="name3");&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;...code for procedure 3...&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel close;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jan 2018 20:32:24 GMT</pubDate>
    <dc:creator>hanyi0221</dc:creator>
    <dc:date>2018-01-08T20:32:24Z</dc:date>
    <item>
      <title>SGplot - macro do loop produce many graphs and output in one excel file with identical sheets' name?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/423725#M14615</link>
      <description>&lt;P&gt;I'm working on multiple graphs (around 100) and have used SGPLot&amp;nbsp; to produce graphs. So now my question is how can I output all the graphs into one excel and in different work sheets. Here is my code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro subdat;&lt;/P&gt;&lt;P&gt;%do z = 1 %to 10;&lt;/P&gt;&lt;P&gt;%let sheet=%scan(&amp;amp;sheets.,&amp;amp;z);&lt;/P&gt;&lt;P&gt;proc import datafile="&amp;amp;path.\test.xls"&lt;BR /&gt;out=T&amp;amp;sheet. dbms=xls replace; sheet="&amp;amp;sheet."; getnames=yes; run;&lt;/P&gt;&lt;P&gt;ods listing close;&lt;BR /&gt;ods graphics / width=14in height=8in;&lt;BR /&gt;ods excel file="&amp;amp;outpath.\tables.xlsx"&lt;BR /&gt;options(SHEET_NAME="&amp;amp;sheet." embedded_titles="yes" embed_titles_once="yes" );&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SGPLOT DATA = T&amp;amp;sheet. dattrmap=attrmap noborder;&lt;BR /&gt;SERIES Y = PPS_NAME X = Performance_Goal/LINEATTRS=(COLOR=firebrick thickness=3) CURVELABEL="Performance Goal=&amp;amp;Target." CURVELABELPOS=end CURVELabelattrs=(size=8pt weight=bold color=firebrick);&lt;BR /&gt;Scatter Y=PPS_NAME X = MY0R/markerAttrs=(COLOR=gainsboro size=6mM symbol=CIRCLEFILLED) attrid=MY0R;&lt;BR /&gt;Scatter Y=PPS_NAME X = MY1R/markerAttrs=(size=6mM) group=ALL_PPS attrid=ALL_PPS datalabel=MY1R DATALABELATTRS=(size=9pt Family=ArialNarrow weight=bold COLOR=White) DATALABELPOS=CENTER transparency=0.1 discreteoffset=0.12;&lt;BR /&gt;Scatter Y=PPS_NAME X = MY2R/markerAttrs=(size=6mM) group=Met_AIT attrid=Met_T datalabel=MY2R DATALABELATTRS=(size=9pt Family=ArialNarrow weight=bold COLOR=White) DATALABELPOS=CENTER transparency=0.1 discreteoffset=0.12;&lt;BR /&gt;XAXIS&amp;nbsp; label=' ';&lt;BR /&gt;YAXIS&amp;nbsp; LABEL = ' ' labelattrs=(color=White) valueattrs=(size=8pt Family=Arial color=black ) GRID gridattrs=(color=WhiteSmoke) MINORGRIDATTRS=(color=green pattern=longdash thickness=2);&lt;BR /&gt;keylegend 'Percent'/noborder;&lt;BR /&gt;title "&amp;amp;sheet.";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Ods excel close;&lt;BR /&gt;%end;&lt;BR /&gt;%mend subdat;&lt;BR /&gt;%subdat;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 14:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/423725#M14615</guid>
      <dc:creator>hanyi0221</dc:creator>
      <dc:date>2017-12-27T14:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: SGplot - macro do loop produce many graphs and output in one excel file with identical sheets' n</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/423732#M14616</link>
      <description>&lt;P&gt;Hi:&lt;BR /&gt; Every time you invoke ODS EXCEL with FILE=, it creates a NEW file. If you want to create 1 workbook with many worksheets, the basic model is:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel file='wholeWB.xlsx';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel options(sheet_name="name1");&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;...code for procedure 1 ...;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel options(sheet_name="name2");&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;...code for procedure 2...&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel options(sheet_name="name3");&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;...code for procedure 3...&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel close;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;That should give you some idea of the basic way it works outside of macros or do loops. So if you are going to introduce macros and do loops, you need to work within the constraints of how ODS EXCEL works.&lt;BR /&gt;&lt;BR /&gt;cynthia&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 14:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/423732#M14616</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-12-27T14:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: SGplot - macro do loop produce many graphs and output in one excel file with identical sheets' n</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/423902#M14625</link>
      <description>&lt;P&gt;Thank you, so I guess I need to produce 10 excel files instead of one file with 10 worksheets.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 14:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/423902#M14625</guid>
      <dc:creator>hanyi0221</dc:creator>
      <dc:date>2017-12-28T14:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: SGplot - macro do loop produce many graphs and output in one excel file with identical sheets' n</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/423922#M14626</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; The code I posted was based on your original statement that you needed "&lt;SPAN&gt;one excel and in different work sheets" -- to me that implied one WORKBOOK with multiple WORKSHEETS. So that was the basis for the code sample I posted. If you now want multiple WORKBOOKS, each a separate .XLSX file, with one WORKSHEET in each WORKBOOK, then the model would be different:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;** some do loop syntax that sets a changing ## for the FILE= option;
  
ods excel file="workbook_##.xlsx";
*** code for procedure output;
ods excel close;
  
** end do loop syntax;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you are going to produce a uniquely named XLSX file for every iteration of a loop of some kind (probably a Macro %DO loop, then you need to have a macro variable that changes the name every time ODS EXCEL is invoked.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;cynthia&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Dec 2017 16:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/423922#M14626</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2017-12-28T16:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: SGplot - macro do loop produce many graphs and output in one excel file with identical sheets' n</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/425906#M14698</link>
      <description>&lt;P&gt;Hi Cynthia,&amp;nbsp;&lt;/P&gt;&lt;P&gt;My earlier reply means I cannot use the following code from you in my macro since I only have one procedure (same procedure for all the sheets) and I don't want to write it 10 times so I guess I can only output 10 different files instead of 10 sheets under same file name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel file='wholeWB.xlsx';&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel options(sheet_name="name1");&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;...code for procedure 1 ...;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel options(sheet_name="name2");&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;...code for procedure 2...&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel options(sheet_name="name3");&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;...code for procedure 3...&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ods excel close;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 20:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/425906#M14698</guid>
      <dc:creator>hanyi0221</dc:creator>
      <dc:date>2018-01-08T20:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: SGplot - macro do loop produce many graphs and output in one excel file with identical sheets' n</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/425919#M14700</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; You could investigate the use of sheet_interval to get a separate sheet based on the procedure output. For example, with BY group processing, I can use sheet_interval='bygroup' to get multiple sheets, as shown below.&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sheet_interval.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17709i6F097B16F52056FE/image-size/large?v=v2&amp;amp;px=999" role="button" title="sheet_interval.png" alt="sheet_interval.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 21:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/425919#M14700</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-01-08T21:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: SGplot - macro do loop produce many graphs and output in one excel file with identical sheets' n</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/425927#M14703</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94812"&gt;@hanyi0221&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Cynthia,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My earlier reply means I cannot use the following code from you in my macro since I only have one procedure (same procedure for all the sheets) and I don't want to write it 10 times so I guess I can only output 10 different files instead of 10 sheets under same file name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That statement is NOT true.&amp;nbsp; Your original posting is executing a separate PROC SGPLOT step for each iteration of the macro %DO loop. Just move the ODS statement with FILE= option outside of the %DO loop and leave the ODS statements with the SHEET_NAME= option inside the %DO loop.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2018 21:46:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/425927#M14703</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-01-08T21:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: SGplot - macro do loop produce many graphs and output in one excel file with identical sheets' n</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/426194#M14710</link>
      <description>&lt;P&gt;Thanks Cynthia and Tom,&amp;nbsp; it works now.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2018 18:32:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGplot-macro-do-loop-produce-many-graphs-and-output-in-one-excel/m-p/426194#M14710</guid>
      <dc:creator>hanyi0221</dc:creator>
      <dc:date>2018-01-09T18:32:37Z</dc:date>
    </item>
  </channel>
</rss>

