<?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: scatter plot in a loop in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396397#M13581</link>
    <description>&lt;P&gt;Macro variables DO NOT resolve within single quotes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This allows the the processor to not resolve the &amp;amp; when it's needed for text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Sep 2017 15:32:11 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-09-15T15:32:11Z</dc:date>
    <item>
      <title>scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396101#M13559</link>
      <description>&lt;P&gt;I am using the code below to generate a series of plots with sgplot in a loop. The process doesn't generate any plots.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;

	array veh_no[2] _temporary_ (3725:3726)
;
	call execute('proc sql;');

	do i=1 to dim(veh_no) while (veh_no(i) ne .);

		call execute(cats('%nrstr(%rept_plot3xxx)(',veh_no(i),')'));
	end;

	call execute('quit;');
run;

%macro rept_plot3xxx(num);
proc sgplot data=DWM_Min_list_3xxx_psi;
  title "&amp;amp;num scatter plot";
  yaxis label= "psi";
  scatter x=OCCUR_DATE y=DWM_TRUCK_1_PRESS_2_FDBK_8451;
  scatter x=OCCUR_DATE y=DWM_TRUCK_2_PRESS_2_FDBK_8453;
  where VEHICLE_NO = '&amp;amp;num' and
  DWM_TRUCK_1_PRESS_2_FDBK_8451 between 0 and 25 and
  DWM_TRUCK_2_PRESS_2_FDBK_8453 between 0 and 25
;
run;
%mend rept_plot3xxx;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Sep 2017 21:07:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396101#M13559</guid>
      <dc:creator>capam</dc:creator>
      <dc:date>2017-09-14T21:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396103#M13560</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/154084"&gt;@capam&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am using the code below to generate a series of plots with sgplot in a loop. The process doesn't generate any plots.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why not?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 21:10:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396103#M13560</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-14T21:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396104#M13561</link>
      <description>&lt;P&gt;You need to call the macro after defining it.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 21:11:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396104#M13561</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-09-14T21:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396117#M13565</link>
      <description>&lt;P&gt;Since your data _null_ step comes before the macro definition then when it executed you may not have had the macro to call. What does your LOG look like? I suspect, at least the first time, the you&amp;nbsp;may have had&amp;nbsp;messages about "Apparent invocation of macro rep_plot3xxx not resolved".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or verify that you have values in this range in the data set DWM_Min_list_3xxx_psi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token statement"&gt;where&lt;/SPAN&gt; VEHICLE_NO &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'&amp;amp;num'&lt;/SPAN&gt; and&lt;BR /&gt;&amp;nbsp; DWM_TRUCK_1_PRESS_2_FDBK_8451 between &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; and &lt;SPAN class="token number"&gt;25&lt;/SPAN&gt; and&lt;BR /&gt;&amp;nbsp; DWM_TRUCK_2_PRESS_2_FDBK_8453 between &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; and &lt;SPAN class="token number"&gt;25&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token number"&gt;Does anything happen with &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;%rep_plot3xxx&amp;nbsp;(3725) ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And what is that quit statement doing? Sgplot doesn't require one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Sep 2017 22:39:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396117#M13565</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-14T22:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396371#M13575</link>
      <description>&lt;P&gt;Ballardw,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the quick reply. I tried the following with no plot output.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro rept_plot3xxx(num);
proc sgplot data=DWM_Min_list_3xxx_psi;
  title "&amp;amp;num scatter plot";
  yaxis label= "psi";
  scatter x=OCCUR_DATE y=DWM_TRUCK_1_PRESS_2_FDBK_8451;
  scatter x=OCCUR_DATE y=DWM_TRUCK_2_PRESS_2_FDBK_8453;
  where VEHICLE_NO = '&amp;amp;num' and
  DWM_TRUCK_1_PRESS_2_FDBK_8451 between 0 and 25 and
  DWM_TRUCK_2_PRESS_2_FDBK_8453 between 0 and 25
;
run;
%mend rept_plot3xxx;

%rept_plot3xxx (3725) ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Sep 2017 14:55:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396371#M13575</guid>
      <dc:creator>capam</dc:creator>
      <dc:date>2017-09-15T14:55:47Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396374#M13576</link>
      <description>&lt;P&gt;Submit the following and then post your full log back please if it doesn't work. Note I replaced the single quotes with double quotes to allow the macro variable to resolve. It's a good practice to put your WHERE at the top of your PROC then its clear that your data is filtered somehwo.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options MPRINT SYMBOLGEN MLOGIC;

%macro rept_plot3xxx(num);&lt;BR /&gt; title "&amp;amp;num scatter plot";
proc sgplot data=DWM_Min_list_3xxx_psi;&lt;BR /&gt;  where VEHICLE_NO = "&amp;amp;num" and DWM_TRUCK_1_PRESS_2_FDBK_8451 between 0 and 25 and DWM_TRUCK_2_PRESS_2_FDBK_8453 between 0 and 25 ;
  yaxis label= "psi";
  scatter x=OCCUR_DATE y=DWM_TRUCK_1_PRESS_2_FDBK_8451;
  scatter x=OCCUR_DATE y=DWM_TRUCK_2_PRESS_2_FDBK_8453;

run;
%mend rept_plot3xxx;

%rept_plot3xxx (3725) ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Sep 2017 14:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396374#M13576</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-15T14:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396377#M13577</link>
      <description>&lt;P&gt;I think the problem is in your WHERE clause. You have '&amp;amp;num', which will not resolve the macro variable. You need to use double quotes there, i.e. "&amp;amp;num".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 15:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396377#M13577</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2017-09-15T15:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396393#M13580</link>
      <description>&lt;P&gt;Running the following code produces the plots..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=DWM_Min_list_3xxx_psi;
	title "3725 scatter plot";
	yaxis label= "psi";
	scatter x=OCCUR_DATE y=DWM_TRUCK_1_PRESS_2_FDBK_8451;
	scatter x=OCCUR_DATE y=DWM_TRUCK_2_PRESS_2_FDBK_8453;
	where VEHICLE_NO = '3725' and
		DWM_TRUCK_1_PRESS_2_FDBK_8451 between 0 and 25 and
		DWM_TRUCK_2_PRESS_2_FDBK_8453 between 0 and 25
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Sep 2017 15:29:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396393#M13580</guid>
      <dc:creator>capam</dc:creator>
      <dc:date>2017-09-15T15:29:08Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396397#M13581</link>
      <description>&lt;P&gt;Macro variables DO NOT resolve within single quotes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This allows the the processor to not resolve the &amp;amp; when it's needed for text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 15:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396397#M13581</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-09-15T15:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396409#M13582</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=DWM_Min_list_3xxx_psi;
  title "&amp;amp;num scatter plot";
  yaxis label= "psi";
  scatter x=OCCUR_DATE y=DWM_TRUCK_1_PRESS_2_FDBK_8451;
  scatter x=OCCUR_DATE y=DWM_TRUCK_2_PRESS_2_FDBK_8453;
  where VEHICLE_NO =&lt;FONT color="#ff0000" size="5"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&amp;amp;num&lt;STRONG&gt;&lt;FONT color="#ff0000" size="5"&gt;"&lt;/FONT&gt;&lt;/STRONG&gt; and
  DWM_TRUCK_1_PRESS_2_FDBK_8451 between 0 and 25 and
  DWM_TRUCK_2_PRESS_2_FDBK_8453 between 0 and 25
;
run;&lt;BR /&gt;&lt;BR /&gt;You likely do not have values of '&amp;amp;num' in your data. "&amp;amp;num" to resolve the macro variable.
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2017 16:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396409#M13582</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-15T16:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: scatter plot in a loop</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396415#M13583</link>
      <description>Thank you Reeza. This worked right away and I was able to easily automate it.&lt;BR /&gt;&lt;BR /&gt;capam</description>
      <pubDate>Fri, 15 Sep 2017 16:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/scatter-plot-in-a-loop/m-p/396415#M13583</guid>
      <dc:creator>capam</dc:creator>
      <dc:date>2017-09-15T16:21:23Z</dc:date>
    </item>
  </channel>
</rss>

