<?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: Controlling the line and marker attributes in &amp;quot;Proc Template&amp;quot; for Scatter Plot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718340#M222305</link>
    <description>thanks I figured out after reading  your code further, I understand it better. I am learning the graphs so I was trying to do in both in procedures.   Can you suggest which one easy and better if  same table can achieve by both procedures! also I have question How  we can merge the key legends in both procedures like, on the bottom of the graph ( placebo---------------, placebo: # then key legend should come as placebo ;-----#------</description>
    <pubDate>Wed, 10 Feb 2021 18:07:54 GMT</pubDate>
    <dc:creator>SASuserlot</dc:creator>
    <dc:date>2021-02-10T18:07:54Z</dc:date>
    <item>
      <title>Controlling the line and marker attributes in "Proc Template" for Scatter Plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718013#M222129</link>
      <description>&lt;P&gt;I am looking to create a scatter plot. when I run my program its giving the default colors and symbols for markers. I would like to know how can I control the colors&amp;nbsp; &amp;nbsp;and symbols of the two different groups in the graph. In the below picture I am getting the red and blue colors by default. I have the following questions.&lt;/P&gt;
&lt;P&gt;1. How I can control the color of the each group?&lt;/P&gt;
&lt;P&gt;2. In the picture, both have the marker Circle filled, Can I have different symbol for each group?&lt;/P&gt;
&lt;P&gt;3. How I can make the dotted line to regular line and regular line into dotted line?&lt;/P&gt;
&lt;P&gt;4. In my Template procedure "megedleged" statment&amp;nbsp; staying in red, but no errors in log, do I miss any thing n the code. Please let me know&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_2-1612903462077.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54520i555E42F3DC6B43D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_2-1612903462077.png" alt="SASuserlot_2-1612903462077.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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="SASuserlot_0-1612903252787.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54518iD45262F5F5F722EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1612903252787.png" alt="SASuserlot_0-1612903252787.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ScatCurve;    /* example data: scatter plot and curves */
call streaminit(1);
do Group = 1 to 2;
   do x = 0 to 5 by 0.2;
      Pred = Group + (1/Group)*x - (0.2*x)**2;
      y = Pred + rand("Normal",0,0.5);
      output;
   end;
end;
run;
proc template;
  define statgraph ScatCurveLegend;
  dynamic _X _Y _Curve _Group _Title;       /* dynamic variables */
  begingraph;
  entrytitle _Title;  
   layout overlay; 
     scatterplot x=_X y=_Y / group=_Group name="obs" markerattrs=(symbol=CircleFilled);
     seriesplot x=_X y=_Curve / group=_Group name="curves" ;
     /* specify exactly two names for the MERGEDLEGEND statement */
     mergedlegend "obs" "curves" / border=true title=_Group;
   endlayout;
  endgraph;
  end;
run;
ods rtf file = "C:\Users\xxu\Desktop\New folder\xx_sample.rtf"  ; 
 
proc sgrender data=ScatCurve template=ScatCurveLegend;
   dynamic _Title="Overlay Curves, Merged Legend"
           _X="x" _Y="y" _Curve="Pred" _Group="Group";
run;
ods rtf close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your Reponses.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 20:44:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718013#M222129</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-02-09T20:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling the line and marker attributes in "Proc Template" for Scatter Plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718021#M222130</link>
      <description>My *lazy trick* to figuring out what options I need to change is to use SGPLOT and specify what I want using the STYLEATTRS statement and use the TMPLOUT option on the SGPLOT statement to pipe the code to a file and see how it was specified in their template.&lt;BR /&gt;&lt;BR /&gt;STYLEATTRS statement&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatproc&amp;amp;docsetTarget=p1dt33l6a6epk6n1chtynsgsjgit.htm&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatproc&amp;amp;docsetTarget=p1dt33l6a6epk6n1chtynsgsjgit.htm&amp;amp;locale=en&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;TMPLOUT option&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatproc&amp;amp;docsetTarget=p073bl97jzadkmn15lhq58yiy2uh.htm&amp;amp;locale=en#n086387n9y3ct3n1i9djru01fomy" target="_blank"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatproc&amp;amp;docsetTarget=p073bl97jzadkmn15lhq58yiy2uh.htm&amp;amp;locale=en#n086387n9y3ct3n1i9djru01fomy&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 09 Feb 2021 20:59:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718021#M222130</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-09T20:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling the line and marker attributes in "Proc Template" for Scatter Plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718024#M222132</link>
      <description>&lt;P&gt;Have you looked at the DATTRMAP option for Proc Sgrender?&lt;/P&gt;
&lt;P&gt;That uses a data set to control attributes of lines and markers based on values you provide.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 21:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718024#M222132</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-09T21:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling the line and marker attributes in "Proc Template" for Scatter Plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718033#M222133</link>
      <description>&lt;P&gt;So, expanding on my suggestion, using STYLEATTRS gets you this code via SGPLOT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=scatCurve tmplout="/home/fkhurshed/graph_code.sas";
styleattrs  datalinepatterns=(dot solid) datasymbols=(trianglefilled circlefilled) ;
scatter x= x y=y / group = group ;
series x= x y = Pred / group = group;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The template then looks like this, with the datasymbols and dataLinePatterns options specified. This is ONE way to do this. Using a data attribute map is another option, and you can replicate this methodolgy to see how to implement it, using this &lt;A href="https://communities.sas.com/t5/Graphics-Programming/Symbols-in-a-scatterplot-with-grouped-data/td-p/178316" target="_self"&gt;similar question&lt;/A&gt;.&lt;/P&gt;
&lt;PRE&gt;proc template;
define statgraph sgplot;
begingraph / collation=binary subpixel=on &lt;FONT size="4" color="#FF6600"&gt;&lt;STRONG&gt;dataSymbols=( TRIANGLEFILLED CIRCLEFILLED ) dataLinePatterns=( 34 1 );&lt;/STRONG&gt;&lt;/FONT&gt;
layout overlay / yaxisopts=(labelFitPolicy=Split) y2axisopts=(labelFitPolicy=Split);
   ScatterPlot X='x'n Y='y'n / subpixel=off primary=true Group='Group'n LegendLabel="y" NAME="SCATTER";
   SeriesPlot X='x'n Y='Pred'n / Group='Group'n LegendLabel="Pred" NAME="SERIES";
   DiscreteLegend "SCATTER"/ title="Group";
endlayout;
endgraph;
end;
run;
&lt;/PRE&gt;
&lt;P&gt;You could then modify your template code, the BEGINGRAPH statement to mimic this (and remove the marker option on the SCATTER) and it seems to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc template;
  define statgraph ScatCurveLegend;
  dynamic _X _Y _Curve _Group _Title;       /* dynamic variables */
  begingraph / dataSymbols=( TRIANGLEFILLED CIRCLEFILLED ) dataLinePatterns=( 34 1 );
  entrytitle _Title;  
   layout overlay; 
     scatterplot x=_X y=_Y / group=_Group name="obs" ;
     seriesplot x=_X y=_Curve / group=_Group name="curves" ;
     /* specify exactly two names for the MERGEDLEGEND statement */
     mergedlegend "obs" "curves" / border=true title=_Group;
   endlayout;
  endgraph;
  end;
run;

proc sgrender data=ScatCurve template=ScatCurveLegend;
   dynamic _Title="Overlay Curves, Merged Legend"
           _X="x" _Y="y" _Curve="Pred" _Group="Group";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Feb 2021 21:41:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718033#M222133</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-09T21:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling the line and marker attributes in "Proc Template" for Scatter Plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718063#M222146</link>
      <description>&lt;P&gt;Thanks for your reply,&amp;nbsp; I am new to graphs, I will search for what you mentioned. Thanks for giving me the direction.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Feb 2021 23:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718063#M222146</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-02-09T23:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling the line and marker attributes in "Proc Template" for Scatter Plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718077#M222153</link>
      <description>&lt;P&gt;Thanks. I am new to graphs. I will play with the code and the references you provided&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 00:19:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718077#M222153</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-02-10T00:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling the line and marker attributes in "Proc Template" for Scatter Plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718078#M222154</link>
      <description>&lt;P&gt;Thanks for you detailed code, however I have a question extension to previous one, your code give default blue and red colors. Where we can control these?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Feb 2021 00:25:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718078#M222154</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-02-10T00:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling the line and marker attributes in "Proc Template" for Scatter Plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718304#M222276</link>
      <description>Colour of lines or markers? &lt;BR /&gt;&lt;BR /&gt;Use the exact same approach to find the options, you should be able to extend my example. Are you having difficulty with some part of the approach? &lt;BR /&gt;&lt;BR /&gt;I didn’t specifically ask, but is there a reason you’re using a template instead of SGPLOT directly?</description>
      <pubDate>Wed, 10 Feb 2021 16:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718304#M222276</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-02-10T16:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling the line and marker attributes in "Proc Template" for Scatter Plot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718340#M222305</link>
      <description>thanks I figured out after reading  your code further, I understand it better. I am learning the graphs so I was trying to do in both in procedures.   Can you suggest which one easy and better if  same table can achieve by both procedures! also I have question How  we can merge the key legends in both procedures like, on the bottom of the graph ( placebo---------------, placebo: # then key legend should come as placebo ;-----#------</description>
      <pubDate>Wed, 10 Feb 2021 18:07:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-the-line-and-marker-attributes-in-quot-Proc-Template/m-p/718340#M222305</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2021-02-10T18:07:54Z</dc:date>
    </item>
  </channel>
</rss>

