<?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: SAS do loop sgplot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431406#M106714</link>
    <description>&lt;P&gt;This is a nice solution and it works as expected...Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Jan 2018 19:04:26 GMT</pubDate>
    <dc:creator>ANLYNG</dc:creator>
    <dc:date>2018-01-26T19:04:26Z</dc:date>
    <item>
      <title>SAS do loop sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431234#M106624</link>
      <description>&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;I need to output a separat PDF plot file for each unit which aooear in my data set. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;How can I make this simple and smart?????&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;The code below works but i need to loop it over the different units in the dataset so I output one plot per unit.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;The dataset plot1 contains data for&amp;nbsp;several units.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Hope you have some ideas.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Thanks in advance,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SAS program:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;* data selection;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; plot1; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; masterdata(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(year notin(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'2018'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) and&amp;nbsp;unitname&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; in(&amp;amp;unit&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) )) other_sum;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;*make&amp;nbsp;PDF file;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ods&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pdf&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;file&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"C:/SGPLOT/&amp;amp;unit..pdf"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;notoc&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;SGPLOT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = plot1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SERIES&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = var1/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=green) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SERIES&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = var2 /&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=red) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SERIES&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; =var3/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=green &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pattern&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=dash) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SERIES&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; =var4/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=red &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pattern&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=dash);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;yaxis&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;values&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; to &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;100&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; by &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;TITLE&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;'Plot for &amp;amp;unit'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ods&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pdf&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;close&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 12:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431234#M106624</guid>
      <dc:creator>ANLYNG</dc:creator>
      <dc:date>2018-01-26T12:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS do loop sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431256#M106636</link>
      <description>&lt;P&gt;You need to create a macro, and a %DO loop inside the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, repeat the PROC SGPLOT code four times, and create only one SERIES statement in each repetition.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 13:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431256#M106636</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-01-26T13:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS do loop sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431337#M106683</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/26102"&gt;@ANLYNG&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;I need to output a separat PDF plot file for each unit which aooear in my data set. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;How can I make this simple and smart?????&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;The code below works but i need to loop it over the different units in the dataset so I output one plot per unit.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;The dataset plot1 contains data for&amp;nbsp;several units.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Hope you have some ideas.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Thanks in advance,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SAS program:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;* data selection;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; plot1; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; masterdata(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(year notin(&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;'2018'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) and&amp;nbsp;unitname&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; in(&amp;amp;unit&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) )) other_sum;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;*make&amp;nbsp;PDF file;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ods&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pdf&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;file&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="2"&gt;"C:/SGPLOT/&amp;amp;unit..pdf"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;notoc&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;SGPLOT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = plot1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SERIES&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = var1/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=green) ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SERIES&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = var2 /&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=red) ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SERIES&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; =var3/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=green &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pattern&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=dash) ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SERIES&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; =var4/&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=red &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pattern&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=dash);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;yaxis&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;values&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; to &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;100&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; by &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;TITLE&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="2"&gt;'Plot for &amp;amp;unit'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;ods&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;pdf&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;close&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;First would be to change the data so that you have a single Y variable and another variable to indicate group membership. Use the Group=option to point to that variable to create different lines for each value of group.&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;SERIES&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="2"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="2"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = value/ group=ygroupvariable;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you get that working then you could either use a macro loop over your list of variables to make the individual output PDF documents. However you haven't given us a connection between "unit" and your data so can't be too specific here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This forum and others have many bits of looping over variable names to create files, table or graphs either using macro code or call execute statements with a control data set containing things such as your "unit" information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 16:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431337#M106683</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-01-26T16:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: SAS do loop sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431338#M106684</link>
      <description>&lt;P&gt;If you change your SGPLOT procedure to use a BY statement you can use the NEWFILE option on the ODS PDF statement to generate a new file for each BY group.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However the naming convention sucks, it names it Report1, Report2.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want control over the file names then I think you need to use a macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that your Title statement needs double quotes to work properly. If you're using BY group processing look at customizing the title using the BYVAL values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods pdf file="C:/SGPLOT/Unit.pdf" notoc newfile=ByGroup;
PROC SGPLOT DATA = plot1;
 
By UNIT;
SERIES X = Reg_aar Y = var1/lineattrs=(color=green) ;
SERIES X = Reg_aar Y = var2 /lineattrs=(color=red) ;
SERIES X = Reg_aar Y =var3/lineattrs=(color=green pattern=dash) ;
SERIES X = Reg_aar Y =var4/lineattrs=(color=red pattern=dash);
yaxis values=(0 to 100 by 20);
 
TITLE "Plot for &amp;amp;unit";
RUN;
ods pdf close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/26102"&gt;@ANLYNG&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;I need to output a separat PDF plot file for each unit which aooear in my data set. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;How can I make this simple and smart?????&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;The code below works but i need to loop it over the different units in the dataset so I output one plot per unit.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;The dataset plot1 contains data for&amp;nbsp;several units.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Hope you have some ideas.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Thanks in advance,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;SAS program:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;* data selection;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; plot1; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; masterdata(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(year notin(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;'2018'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) and&amp;nbsp;unitname&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; in(&amp;amp;unit&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;) )) other_sum;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;*make&amp;nbsp;PDF file;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;ods&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;pdf&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;file&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"C:/SGPLOT/&amp;amp;unit..pdf"&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;notoc&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;SGPLOT&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;DATA&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = plot1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;SERIES&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = var1/&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=green) ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;SERIES&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = var2 /&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=red) ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;SERIES&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; =var3/&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=green &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;pattern&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=dash) ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;SERIES&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;X&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; = Reg_aar &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;Y&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; =var4/&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;lineattrs&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;color&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=red &lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;pattern&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=dash);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;yaxis&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;values&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=(&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; to &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;100&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; by &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;20&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;TITLE&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#800080"&gt;'Plot for &amp;amp;unit'&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;ods&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;pdf&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;close&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 16:29:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431338#M106684</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-01-26T16:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: SAS do loop sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431406#M106714</link>
      <description>&lt;P&gt;This is a nice solution and it works as expected...Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2018 19:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-do-loop-sgplot/m-p/431406#M106714</guid>
      <dc:creator>ANLYNG</dc:creator>
      <dc:date>2018-01-26T19:04:26Z</dc:date>
    </item>
  </channel>
</rss>

