<?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 to put refline in a plot with percent sign in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710753#M26810</link>
    <description>&lt;P&gt;Takes a little pre-work, but see if you can use this as a template&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input DATE $9. TIME $ 10-18;
datalines;
04JAN2021 same day
04JAN2021 same day
05JAN2021 same day
05JAN2021 same day
05JAN2021 next day
05JAN2021 next day
;

proc sort data=test;
   by date;
run;

proc freq data = test noprint;  
   by date; 
   tables time / out = temp;   
run;

proc sgplot data = temp;
   vbarparm category=date response=percent / group=time groupdisplay=stack;
   refline 80 / lineattrs=(thickness=5 color=black);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&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-center" image-alt="sgplot.PNG" style="width: 642px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53403iDB1755FCB8420A19/image-size/large?v=v2&amp;amp;px=999" role="button" title="sgplot.PNG" alt="sgplot.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jan 2021 09:22:34 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-01-12T09:22:34Z</dc:date>
    <item>
      <title>How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710742#M26805</link>
      <description>&lt;P&gt;I have this code for a SGPLOT:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SGPLOT DATA = DATA PCTLEVEL=GROUP NOBORDER NOWALL ;
format DATE ddmmyyd10.;
VBAR DATE/ GROUP = TIME stat= percent NOOUTLINE grouporder= data ;
Title1 font = 'Calibri' height=16pt "TEST";
keylegend / title="";
XAXIS DISPLAY=(NOLABEL);
YAXIS DISPLAY=(NOLABEL);
styleattrs DATACOLORS=(LightBlue STEEL MistyRose FireBrick);
RUN; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i wish to show a line from the y-axis at 80% on the plot, like this? How can I do that?&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="mmea_0-1610440678665.png"&gt;&lt;img src="https://communities.sas.com/skins/images/E0BB18E7DAA53C21BC28740CEA0E38DA/responsive_peak/images/image_not_found.png" alt="mmea_0-1610440678665.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 08:38:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710742#M26805</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-01-12T08:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710745#M26806</link>
      <description>&lt;P&gt;I'm guessing you already checked out the Refline Statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While the Refline Statement can not be used with Vbar, it &lt;EM&gt;can&amp;nbsp;&lt;/EM&gt;be used with VbarParm. See the chart here to see &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=grstatproc&amp;amp;docsetTarget=p0yud64khw8fuin1xgr85dgxbb7t.htm&amp;amp;locale=en" target="_self"&gt;Compatible Statements in Proc SGPLOT&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try using Vbarparm and Refline together &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 08:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710745#M26806</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-12T08:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710747#M26807</link>
      <description>&lt;P&gt;The vbarparm dosent work with my data.&lt;/P&gt;&lt;P&gt;in vbar I use dates as variable and my group is a string/labels&lt;/P&gt;&lt;P&gt;in vbarparm you have to have a numeric variable?&lt;/P&gt;&lt;P&gt;or am i wrong&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:00:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710747#M26807</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-01-12T09:00:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710748#M26808</link>
      <description>&lt;P&gt;Can you show a portion of your data?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710748#M26808</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-12T09:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710749#M26809</link>
      <description>&lt;P&gt;My dataset i like this just with many more dates :&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DATE&lt;/TD&gt;&lt;TD&gt;TIME&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;04JAN2021&lt;/TD&gt;&lt;TD&gt;same day&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;04JAN2021&lt;/TD&gt;&lt;TD&gt;same day&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;05JAN2021&lt;/TD&gt;&lt;TD&gt;same day&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;05JAN2021&lt;/TD&gt;&lt;TD&gt;same day&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;05JAN2021&lt;/TD&gt;&lt;TD&gt;next day&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;05JAN2021&lt;/TD&gt;&lt;TD&gt;next day&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SGPLOT DATA = TEST PCTLEVEL=GROUP NOBORDER NOWALL ;
format DATE ddmmyyd10.;
VBAR DATE/ GROUP = TIME stat= percent NOOUTLINE grouporder= data ;
Title1 font = 'Calibri' height=16pt "test";
keylegend / title="";
XAXIS DISPLAY=(NOLABEL);
YAXIS DISPLAY=(NOLABEL);
styleattrs DATACOLORS=(LightBlue STEEL MistyRose FireBrick);

RUN; &lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:05:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710749#M26809</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-01-12T09:05:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710753#M26810</link>
      <description>&lt;P&gt;Takes a little pre-work, but see if you can use this as a template&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input DATE $9. TIME $ 10-18;
datalines;
04JAN2021 same day
04JAN2021 same day
05JAN2021 same day
05JAN2021 same day
05JAN2021 next day
05JAN2021 next day
;

proc sort data=test;
   by date;
run;

proc freq data = test noprint;  
   by date; 
   tables time / out = temp;   
run;

proc sgplot data = temp;
   vbarparm category=date response=percent / group=time groupdisplay=stack;
   refline 80 / lineattrs=(thickness=5 color=black);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&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-center" image-alt="sgplot.PNG" style="width: 642px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53403iDB1755FCB8420A19/image-size/large?v=v2&amp;amp;px=999" role="button" title="sgplot.PNG" alt="sgplot.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:22:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710753#M26810</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-12T09:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710755#M26811</link>
      <description>&lt;P&gt;thank you - but it says that percent is not found?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710755#M26811</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-01-12T09:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710756#M26812</link>
      <description>&lt;P&gt;it works now!!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:28:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710756#M26812</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-01-12T09:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710757#M26813</link>
      <description>&lt;P&gt;I'm glad you found your answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710757#M26813</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-12T09:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710758#M26814</link>
      <description>&lt;P&gt;Please remember to close the thread &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:30:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710758#M26814</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-12T09:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710759#M26815</link>
      <description>&lt;P&gt;I am just curious if I can change the order of my legend.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the labels "same day", "next day", "2 days after", "more than 2 days"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wish to have that same order - but it mixes up in the plot.&lt;/P&gt;&lt;P&gt;I have sorted by date and also tried with time&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710759#M26815</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-01-12T09:36:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710760#M26816</link>
      <description>&lt;P&gt;What version of SAS do you use?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you want them in that order in the Legend as well as in the actual plot, correct? With 'Same Day' in the bottom and so forth?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:40:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710760#M26816</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-12T09:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710761#M26817</link>
      <description>&lt;P&gt;exactly - i tried actually to do grouporder = descending - and it worked?&lt;/P&gt;&lt;P&gt;But if you have a better way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i use SAS 9.4&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710761#M26817</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-01-12T09:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710764#M26818</link>
      <description>&lt;P&gt;There are several ways to do this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would probably go this way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input DATE $9. TIME $ 10-26;
datalines;
04JAN2021 same day        
04JAN2021 same day        
05JAN2021 same day        
05JAN2021 same day        
05JAN2021 2 days after    
05JAN2021 2 days after    
05JAN2021 next day        
05JAN2021 next day        
05JAN2021 more than 2 days
05JAN2021 more than 2 days
;

proc sort data=test;
   by date;
run;

proc freq data = test noprint;  
   by date; 
   tables time / out = temp;   
run;

proc sql;
   create table plot as
   select * from temp
   order by date, whichc(time, "same day", "next day", "2 days after", "more than 2 days");
quit;

proc sgplot data = plot;
   vbarparm category=date response=percent / group=time groupdisplay=stack grouporder=data;
   refline 80 / lineattrs=(thickness=5 color=black);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&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-center" image-alt="sgplot.PNG" style="width: 646px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53404iA19782128F3B207A/image-size/large?v=v2&amp;amp;px=999" role="button" title="sgplot.PNG" alt="sgplot.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710764#M26818</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-12T09:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710765#M26819</link>
      <description>&lt;P&gt;Thank you!!!!!!!!!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710765#M26819</guid>
      <dc:creator>mmea</dc:creator>
      <dc:date>2021-01-12T09:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to put refline in a plot with percent sign</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710766#M26820</link>
      <description>&lt;P&gt;Anytime.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 09:55:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-put-refline-in-a-plot-with-percent-sign/m-p/710766#M26820</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-12T09:55:45Z</dc:date>
    </item>
  </channel>
</rss>

