<?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 Note: UsingRe: PROC SGPLOT  STAT = PERCENT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/700809#M214516</link>
    <description>&lt;P&gt;Note: Using uppercase for user-defined strings would make your code a lot more legible (and avoid having to specify what is what as I was forced to do in my previous reply).&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;proc sgplot data = LEARN.DATA_MAIN;
    vbar PLACE / response=CHECK stat=percent group=INS groupdisplay=cluster datalabel=ROW_PERCENT ;    
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Nov 2020 01:26:22 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2020-11-23T01:26:22Z</dc:date>
    <item>
      <title>PROC SGPLOT  STAT = PERCENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/700747#M214490</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Is there any way to display the ROW PCT (ROW PERCENT generated in proc freq) on top of the bars (VBAR) in the bar graph instead of the total percentage? I used PROC SGPLOT and the option STAT = PERCENT. However, it displays the total percent, and I want to display the row percent above the bars. I used datalabel option to display the statistic.&lt;/P&gt;&lt;P&gt;Here is the sample of the code;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data = learn.data_main;
    vbar Place / response = check stat = percent  
    group = Ins groupdisplay = cluster datalabel ;    
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Does anyone have a suggestion? Thanks in advance! * I use SAS 9.4 in windows.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Nov 2020 14:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/700747#M214490</guid>
      <dc:creator>Gayatrikunchay</dc:creator>
      <dc:date>2020-11-22T14:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT  STAT = PERCENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/700808#M214515</link>
      <description>&lt;P&gt;Have you tried this?&lt;/P&gt;
&lt;H5 class="xisDoc-option"&gt;data_label= ROW_PERCENT&amp;nbsp; (use the variable name)&lt;/H5&gt;</description>
      <pubDate>Mon, 23 Nov 2020 01:22:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/700808#M214515</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-11-23T01:22:27Z</dc:date>
    </item>
    <item>
      <title>Note: UsingRe: PROC SGPLOT  STAT = PERCENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/700809#M214516</link>
      <description>&lt;P&gt;Note: Using uppercase for user-defined strings would make your code a lot more legible (and avoid having to specify what is what as I was forced to do in my previous reply).&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;proc sgplot data = LEARN.DATA_MAIN;
    vbar PLACE / response=CHECK stat=percent group=INS groupdisplay=cluster datalabel=ROW_PERCENT ;    
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 01:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/700809#M214516</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-11-23T01:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT  STAT = PERCENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/700943#M214580</link>
      <description>&lt;P&gt;Data example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally I don't let any of the graphics procedures to percentages because I almost always need at least one thing different than the graphic procedure can do.&lt;/P&gt;
&lt;P&gt;So, precalculate the data , such as with Proc Freq creating a data set and use that data to plot. Then you have all the values you want.&lt;/P&gt;
&lt;P&gt;You may have to move to a VBARPARM or similar to use such data.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 15:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/700943#M214580</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-11-23T15:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT  STAT = PERCENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701068#M214631</link>
      <description>&lt;P&gt;My bad. I understood the results of proc freq were plotted. Yes, do a proc freq, and then plot what you need.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 21:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701068#M214631</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2020-11-23T21:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT  STAT = PERCENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701135#M214677</link>
      <description>&lt;P&gt;Are you using the output dataset from your PROC FREQ statement? Such as:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ODS OUTPUT Crosstabfreqs = WORK.bargraph;
PROC FREQ DATA=have;
TABLES var*var;
RUN;

Then, try this:&amp;nbsp;

PROC SGPLOT DATA=work.bargraph; *from above ODS OUTPUT statement;
VBAR variable / RESPONSE = RowPercent DATALABEL&amp;nbsp;&lt;BR /&gt;/*I'm assuming RowPercent is the variable name from your ODS OUTPUT dataset*/&lt;BR /&gt;&lt;BR /&gt;Add the rest of your code here;&lt;BR /&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The main difference is the use of RESPONSE= instead of STAT=&lt;/P&gt;&lt;P&gt;Hope that helps!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 03:33:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701135#M214677</guid>
      <dc:creator>strong_s</dc:creator>
      <dc:date>2020-11-24T03:33:28Z</dc:date>
    </item>
    <item>
      <title>Hey Re: PROC SGPLOT  STAT = PERCENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701822#M214930</link>
      <description>&lt;P&gt;Hey everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I actually wanted to display the row percent which I obtained through proc freq. I figured it out. I actually used the&amp;nbsp;PCTLEVEL = GROUP option in the proc sgplot statement. This worked! it displayed the row percentages of the grouped variable which is what I wanted to do. Thanks, everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;proc sgplot data = learn.data_main pctlevel = group;
    vbar Place / response = check stat = percent  
    group = Ins groupdisplay = cluster datalabel ;    
run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 13:45:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701822#M214930</guid>
      <dc:creator>Gayatrikunchay</dc:creator>
      <dc:date>2020-11-26T13:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT  STAT = PERCENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701824#M214931</link>
      <description>&lt;P&gt;Hey!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I apologize if I was not clear. I did a proc freq and I wanted to display the row percent which I got through proc freq. I tried using PCTLEVEL = GROUP option in the proc sgplot statement and it worked for me. It displayed the percentages of the grouped variable and that's what I wanted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 13:40:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701824#M214931</guid>
      <dc:creator>Gayatrikunchay</dc:creator>
      <dc:date>2020-11-26T13:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SGPLOT  STAT = PERCENT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701826#M214932</link>
      <description>&lt;P&gt;I will try this. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 13:41:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SGPLOT-STAT-PERCENT/m-p/701826#M214932</guid>
      <dc:creator>Gayatrikunchay</dc:creator>
      <dc:date>2020-11-26T13:41:56Z</dc:date>
    </item>
  </channel>
</rss>

