<?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: Adding Line Chart with Box Plot in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366308#M12746</link>
    <description>&lt;P&gt;I never mentioned anything about PROC TEMPLATE. I usually avoid that like the plague personally. It's a different language and hard &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What version (exactly!) of SAS are you using, ie SAS 9.4 TS1M3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect you're running into the issue of using an older version of SAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2017 19:30:08 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-06-12T19:30:08Z</dc:date>
    <item>
      <title>Adding Line Chart with Box Plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366286#M12743</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used SAS EG to develop a box plot and have successfully added another variable too.&lt;/P&gt;
&lt;P&gt;The issue is:--&lt;/P&gt;
&lt;P&gt;--&lt;STRONG&gt;One variable&lt;/STRONG&gt; I want Box Plot--showing mean, median, std dev, min and max. I added the box plot. So I am good here.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;--&lt;STRONG&gt;Second&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&amp;nbsp;variable&lt;/STRONG&gt;&lt;SPAN&gt; I want a line chart for it. It has to overlay the box plot with it's own value.--I am NOT&amp;nbsp;able to do so. And want your help with it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Below is the code that I used.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data buy(drop=i );
set sashelp.buy;
do i = 1 to 10;
nos_sale = round(rand("Uniform")*10,1); /* u ~ U(0,1) */
new_sale_amount=amount*rand("Uniform")*13;
output;
end;
run;
run;
proc sql;
create table buy2 as
select
date
,max(nos_sale) as nos_sale
,new_sale_amount
from buy
group by date
;quit;
PROC SQL;
CREATE VIEW WORK.SORTTempTableSorted AS
SELECT T.DATE, T.new_sale_amount, T.nos_sale
FROM WORK.BUY2 as T
;
QUIT;
Legend1 FRAME ;
SYMBOL1 INTERPOL=BOX VALUE=CIRCLE
HEIGHT=1 MODE=EXCLUDE
;
SYMBOL2 interpol=join VALUE=dot
HEIGHT=1 MODE=EXCLUDE
;
Axis1 STYLE=1 WIDTH=1 MINOR=NONE;
Axis2 STYLE=1 WIDTH=1 MINOR=NONE;
Axis3 STYLE=34 WIDTH=1 MINOR=NONE;
TITLE;
TITLE1 "Box Plot";
FOOTNOTE;
FOOTNOTE1 "Generated by the SAS System (&amp;amp;_SASSERVERNAME, &amp;amp;SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";
PROC GPLOT DATA=WORK.SORTTempTableSorted
;
PLOT new_sale_amount * DATE/
VAXIS=AXIS1
HAXIS=AXIS2
LVREF=4
CVREF=BLACK
AUTOVREF
LEGEND=LEGEND1
;
PLOT2 nos_sale * DATE / overlay
VAXIS=AXIS3
LEGEND=LEGEND1
;
RUN; QUIT;
TITLE; FOOTNOTE;
GOPTIONS RESET = SYMBOL;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 18:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366286#M12743</guid>
      <dc:creator>ArpitSharma</dc:creator>
      <dc:date>2017-06-12T18:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Line Chart with Box Plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366289#M12744</link>
      <description>&lt;P&gt;Try using SGPLOT instead of GPLOT, it's easier to add overlaying graph types onto one plot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;GPLOT graphics aren't as nice either. This is a really bad example but shows you how it would be done.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=sashelp.heart;
  title "Cholesterol Distribution by Weight Class";
  hbox cholesterol / category=weight_status;
  series x=weight_status y=mrw / x2axis y2axis;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jun 2017 18:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366289#M12744</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-12T18:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Line Chart with Box Plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366305#M12745</link>
      <description>&lt;P&gt;Thank You for your help.&lt;/P&gt;
&lt;P&gt;Here are couple of things that I tried.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1.The code you suggested does not work. Not sure why but I get this error.--ERROR: Attempting to overlay incompatible plot or chart types.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2.I am &lt;STRONG&gt;guessing&lt;/STRONG&gt; you want me to try proc template. I agree to it. But I want to join the dots highlighted in the attachement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
 define statgraph vbarscat;
 begingraph;
 entrytitle 'Overlay Box Chart and Scatter Plot';
 layout overlay /yaxisopts=(linearopts=			(viewmin=0 viewmax=80
 							tickvaluesequence=	(start=0 end=80 increment=10)
												)
							);
 boxplot x=date y=new_sale_amount /yaxis=y2;
 scatterplot y=nos_sale x=date;
 endlayout;
 endgraph;
 end;
proc sgrender data=buy2 template=vbarscat;
run; 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13930i9E393B70FD791B7F/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="S_Shot.PNG" title="S_Shot.PNG" /&gt;</description>
      <pubDate>Mon, 12 Jun 2017 19:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366305#M12745</guid>
      <dc:creator>ArpitSharma</dc:creator>
      <dc:date>2017-06-12T19:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Line Chart with Box Plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366308#M12746</link>
      <description>&lt;P&gt;I never mentioned anything about PROC TEMPLATE. I usually avoid that like the plague personally. It's a different language and hard &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What version (exactly!) of SAS are you using, ie SAS 9.4 TS1M3&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suspect you're running into the issue of using an older version of SAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 19:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366308#M12746</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-12T19:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Line Chart with Box Plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366326#M12747</link>
      <description>&lt;P&gt;Overlay of Basic Plots like Scatter or Series on VBOX or HBOX is allowed starting with&amp;nbsp;&lt;SPAN&gt;SAS 9.40M3. &amp;nbsp;If you have an older version of SAS, you will get the message you are seeing. &amp;nbsp;GTL template will allow such overlays.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If you want to avoid the effort to learn GTL from scratch, use SGPLOT to create the graph you want with only the VBOX and WITHOUT the SERIES overlay. &amp;nbsp;Then, use the TMPLOUT= option on the proc statement to obtain the generated GTL code. &amp;nbsp;Now, you can edit the code, and add the SERIESPLOT statement to get the additional layers.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 20:04:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366326#M12747</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2017-06-12T20:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Line Chart with Box Plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366573#M12750</link>
      <description>&lt;P&gt;I think this slight modification of your code probably gets a little closer to what you're wanting...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data buy(drop=i ); set sashelp.buy;&lt;BR /&gt;do i = 1 to 10;&lt;BR /&gt;nos_sale = round(rand("Uniform")*10,1); /* u ~ U(0,1) */&lt;BR /&gt;new_sale_amount=amount*rand("Uniform")*13;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table buy2 as&lt;BR /&gt;select&lt;BR /&gt;date&lt;BR /&gt;,max(nos_sale) as nos_sale&lt;BR /&gt;,new_sale_amount&lt;BR /&gt;from buy&lt;BR /&gt;group by date&lt;BR /&gt;;quit;&lt;BR /&gt;PROC SQL;&lt;BR /&gt;CREATE VIEW WORK.SORTTempTableSorted AS&lt;BR /&gt;SELECT T.DATE, T.new_sale_amount, T.nos_sale&lt;BR /&gt;FROM WORK.BUY2 as T&lt;BR /&gt;;&lt;BR /&gt;QUIT;&lt;BR /&gt;Legend1 FRAME ;&lt;BR /&gt;SYMBOL1 INTERPOL=BOX VALUE=CIRCLE&lt;BR /&gt;HEIGHT=1 MODE=EXCLUDE&lt;BR /&gt;color=red&lt;BR /&gt;;&lt;BR /&gt;SYMBOL2 interpol=join VALUE=dot&lt;BR /&gt;HEIGHT=1 MODE=EXCLUDE&lt;BR /&gt;color=blue&lt;BR /&gt;;&lt;BR /&gt;Axis1 STYLE=0 WIDTH=1 MINOR=NONE;&lt;BR /&gt;Axis2 STYLE=1 WIDTH=1 MINOR=NONE label=none;&lt;BR /&gt;Axis3 STYLE=0 WIDTH=1 MINOR=NONE;&lt;BR /&gt;TITLE;&lt;BR /&gt;TITLE1 "Box Plot";&lt;BR /&gt;FOOTNOTE;&lt;BR /&gt;FOOTNOTE1 "Generated by the SAS System (&amp;amp;_SASSERVERNAME, &amp;amp;SYSSCPL) on %TRIM(%QSYSFUNC(DATE(), NLDATE20.)) at %TRIM(%SYSFUNC(TIME(), TIMEAMPM12.))";&lt;BR /&gt;PROC GPLOT DATA=WORK.SORTTempTableSorted&lt;BR /&gt;;&lt;BR /&gt;PLOT new_sale_amount*DATE=1/&lt;BR /&gt;VAXIS=AXIS1&lt;BR /&gt;HAXIS=AXIS2&lt;BR /&gt;LVREF=4&lt;BR /&gt;CVREF=BLACK&lt;BR /&gt;AUTOVREF lvref=33 cvref=gray77&lt;BR /&gt;LEGEND=LEGEND1&lt;BR /&gt;;&lt;BR /&gt;PLOT2 nos_sale*DATE=2 / overlay&lt;BR /&gt;VAXIS=AXIS3&lt;BR /&gt;LEGEND=LEGEND1&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9351iCADFD55AA1B31E07/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="gplot8.png" title="gplot8.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 14:03:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366573#M12750</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2017-06-13T14:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Adding Line Chart with Box Plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366720#M12752</link>
      <description>&lt;P&gt;Thank You Robert and Sanjay.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Both of your solutions worked for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 18:36:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Adding-Line-Chart-with-Box-Plot/m-p/366720#M12752</guid>
      <dc:creator>ArpitSharma</dc:creator>
      <dc:date>2017-06-13T18:36:03Z</dc:date>
    </item>
  </channel>
</rss>

