<?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 Macro for multiple sgplot output but all identical in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-multiple-sgplot-output-but-all-identical/m-p/396732#M95815</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;Following my last trial to output a series of histogram through SQL with different parameters and SAS code as attached.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO SPCDIST;  /*Macro file is needed for repetitive SQL statement*/
%do j=1 %to 10;
PROC SQL;
   CREATE TABLE work.query AS
   SELECT j , i , X , Y FROM MYSECOND.SPC; 
   WHERE J=&amp;amp;j AND Y=0;
   RUN;
   QUIT;
   
   ods graphics / reset imagemap;

   /*--SGPLOT proc statement--*/
   proc sgplot data=WORK.QUERY;
	/*--Histogram settings--*/
	
	histogram X /;

	/*--Vertical or Response Axis--*/
	yaxis grid;
	
   run;
   /*end;
   run;*/
   

   ods graphics / reset;
%end;
%MEND;
%SPCDIST;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The result was output 10 identifical plots (like j=10). I wonder where went wrong and please advise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Mon, 18 Sep 2017 05:42:02 GMT</pubDate>
    <dc:creator>Michaelcwang2</dc:creator>
    <dc:date>2017-09-18T05:42:02Z</dc:date>
    <item>
      <title>Macro for multiple sgplot output but all identical</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-multiple-sgplot-output-but-all-identical/m-p/396732#M95815</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;Following my last trial to output a series of histogram through SQL with different parameters and SAS code as attached.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO SPCDIST;  /*Macro file is needed for repetitive SQL statement*/
%do j=1 %to 10;
PROC SQL;
   CREATE TABLE work.query AS
   SELECT j , i , X , Y FROM MYSECOND.SPC; 
   WHERE J=&amp;amp;j AND Y=0;
   RUN;
   QUIT;
   
   ods graphics / reset imagemap;

   /*--SGPLOT proc statement--*/
   proc sgplot data=WORK.QUERY;
	/*--Histogram settings--*/
	
	histogram X /;

	/*--Vertical or Response Axis--*/
	yaxis grid;
	
   run;
   /*end;
   run;*/
   

   ods graphics / reset;
%end;
%MEND;
%SPCDIST;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The result was output 10 identifical plots (like j=10). I wonder where went wrong and please advise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 05:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-multiple-sgplot-output-but-all-identical/m-p/396732#M95815</guid>
      <dc:creator>Michaelcwang2</dc:creator>
      <dc:date>2017-09-18T05:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for multiple sgplot output but all identical</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-multiple-sgplot-output-but-all-identical/m-p/396734#M95817</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You closed your proc sql step too soon. &amp;nbsp;Correct the sql step, save then rerun. &amp;nbsp;Try this one....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
   CREATE TABLE work.query AS
   SELECT j , i , X , Y FROM MYSECOND.SPC 
   WHERE J=&amp;amp;j AND Y=0;
   RUN;
   QUIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope it helps.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Sep 2017 07:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-multiple-sgplot-output-but-all-identical/m-p/396734#M95817</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-18T07:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Macro for multiple sgplot output but all identical</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-for-multiple-sgplot-output-but-all-identical/m-p/396738#M95818</link>
      <description>Dear ShiroAmada,&lt;BR /&gt;Thank you and you are right! Now it works for ten different charts. Highly appreciated!</description>
      <pubDate>Mon, 18 Sep 2017 07:39:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-for-multiple-sgplot-output-but-all-identical/m-p/396738#M95818</guid>
      <dc:creator>Michaelcwang2</dc:creator>
      <dc:date>2017-09-18T07:39:49Z</dc:date>
    </item>
  </channel>
</rss>

