<?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: How Can I Insert Custom Quantile Line in SGPLOT Graph? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Insert-Custom-Quantile-Line-in-SGPLOT-Graph/m-p/461925#M15928</link>
    <description>&lt;P&gt;Hi, FreelanceReinhard:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply, and your code generated my objective.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="201805141.JPG" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20494i4619BE103B81EF9B/image-size/small?v=v2&amp;amp;px=200" role="button" title="201805141.JPG" alt="201805141.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;</description>
    <pubDate>Mon, 14 May 2018 05:41:30 GMT</pubDate>
    <dc:creator>KentaMURANAKA</dc:creator>
    <dc:date>2018-05-14T05:41:30Z</dc:date>
    <item>
      <title>How Can I Insert Custom Quantile Line in SGPLOT Graph?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Insert-Custom-Quantile-Line-in-SGPLOT-Graph/m-p/461505#M15909</link>
      <description>&lt;P&gt;Hi, All:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know How to Insert Custom Quantile Line to SGPLOT Graph.&lt;/P&gt;&lt;P&gt;Example code is following.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
    input x y @@;
    datalines;
    10 10 4 5 2 5 2 4 8 4 9 6 7 6 5 2
    1 1 3 2 4 7 6 7 8 9 11 8 6 4
    ;
run;
proc univariate data=test noprint;
    var x;
    output out=pctl pctlpts=25 50 75 100 pctlpre=pctl;
run;
data test_1;
    set test;
    if _n_ eq 1 then set pctl;
    if x le pctl25 then pctlgrp=1;
    else if x le pctl50 then pctlgrp=2;
    else if x le pctl75 then pctlgrp=3;
    else if x le pctl100 then pctlgrp=4;
run;
proc sort data=test_1 out=test_2;
    by pctlgrp;
run;
ods output basicintervals=mci(where=(parameter eq "Mean"));
proc univariate data=test_2 cibasic;
    var y;
    by pctlgrp;
run;
proc univariate data=test_2 noprint;
    var x;
    by pctlgrp;
    output out=med median=med;
run;
data mci_1;
    set mci(drop=varname parameter);
run;
data test_3;
    merge test_2(in=a) med(in=b) mci_1(in=c);
    by pctlgrp;
    if a;
run;
proc sgplot data=test_3;
    reg x=x y=y / clm nomarkers;
    scatter x=med y=estimate / yerrorlower=lowercl yerrorupper=uppercl;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;On this graph, I want horizontal line (0th (x=1), 25th (x=3), 50th (x=6), 75th (x=8), 100th (x=11) percentile with marker line) on axis Y's "0.0", like following picture's black line.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LikeThis.JPG" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20456i9534D1B5623B2B97/image-size/small?v=v2&amp;amp;px=200" role="button" title="LikeThis.JPG" alt="LikeThis.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I tried to insert this line by making graph from specific data, but markers "PLUS" were out of this line's end.&lt;/P&gt;&lt;P&gt;Thank you for your kind cooperation.&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, 11 May 2018 09:23:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Insert-Custom-Quantile-Line-in-SGPLOT-Graph/m-p/461505#M15909</guid>
      <dc:creator>KentaMURANAKA</dc:creator>
      <dc:date>2018-05-11T09:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Insert Custom Quantile Line in SGPLOT Graph?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Insert-Custom-Quantile-Line-in-SGPLOT-Graph/m-p/461829#M15918</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/204979"&gt;@KentaMURANAKA&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried the &lt;A href="http://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=p0wbwl2pk2eaetn1bzxbvlyq6e13.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;SG annotation feature&lt;/A&gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, you could include the 0th percentile in your PCTL dataset (see your first PROC UNIVARIATE step):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;output out=pctl pctlpts=&lt;FONT color="#008000"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/FONT&gt; 25 50 75 100 pctlpre=pctl;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use this dataset to supply coordinates to an SG annotation dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%sganno; /* compile SG annotation macros */

data pctlline;
set pctl;
h=0.2; /* half the length of the vertical lines */
%sgline(x1=pctl0, y1=0, x2=pctl100, y2=0, drawspace="datavalue"); /* horizontal line */
%sgline(x1=pctl0, y1=-h, x2=pctl0, y2=h); /* first vertical line */
%sgline(x1=pctl25, x2=pctl25); /* subsequent vertical lines retain the same y-coordinates */
%sgline(x1=pctl50, x2=pctl50);
%sgline(x1=pctl75, x2=pctl75);
%sgline(x1=pctl100, x2=pctl100);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(The &lt;A href="http://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n0ccm26lnl5l0xn1vqkqteioumq9.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;SG annotation macros&lt;/A&gt; are available starting with the first maintenance release of SAS 9.4.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Finally, add the SGANNO= option to your PROC SGPLOT step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=test_3 sganno=pctlline;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know why the vertical lines seem to be shifted a little bit to the right. If this is an issue, you may want to tweak their x-coordinates, e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data pctlline;
set pctlline;
x1=x1-0.02;
x2=x2-0.02;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 May 2018 12:37:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Insert-Custom-Quantile-Line-in-SGPLOT-Graph/m-p/461829#M15918</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-05-13T12:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: How Can I Insert Custom Quantile Line in SGPLOT Graph?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Insert-Custom-Quantile-Line-in-SGPLOT-Graph/m-p/461925#M15928</link>
      <description>&lt;P&gt;Hi, FreelanceReinhard:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your reply, and your code generated my objective.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="201805141.JPG" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/20494i4619BE103B81EF9B/image-size/small?v=v2&amp;amp;px=200" role="button" title="201805141.JPG" alt="201805141.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 05:41:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-Can-I-Insert-Custom-Quantile-Line-in-SGPLOT-Graph/m-p/461925#M15928</guid>
      <dc:creator>KentaMURANAKA</dc:creator>
      <dc:date>2018-05-14T05:41:30Z</dc:date>
    </item>
  </channel>
</rss>

