<?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 SGPLOT histogram with freq data? in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-histogram-with-freq-data/m-p/254850#M9231</link>
    <description>&lt;P&gt;Hi all.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Isn't is possible to create a histogram/density in SGPLOT with data created in Proc Freq? I have data similar to this;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x y
1 0.10
2 0.20
3 0.30
4 0.20
5 0.15
6 0.05&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So, I need six bars and a density plot - but it seems impossible for me to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Sun, 06 Mar 2016 18:37:36 GMT</pubDate>
    <dc:creator>Steffenhaldrup</dc:creator>
    <dc:date>2016-03-06T18:37:36Z</dc:date>
    <item>
      <title>SGPLOT histogram with freq data?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-histogram-with-freq-data/m-p/254850#M9231</link>
      <description>&lt;P&gt;Hi all.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Isn't is possible to create a histogram/density in SGPLOT with data created in Proc Freq? I have data similar to this;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x y
1 0.10
2 0.20
3 0.30
4 0.20
5 0.15
6 0.05&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So, I need six bars and a density plot - but it seems impossible for me to do it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2016 18:37:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-histogram-with-freq-data/m-p/254850#M9231</guid>
      <dc:creator>Steffenhaldrup</dc:creator>
      <dc:date>2016-03-06T18:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT histogram with freq data?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-histogram-with-freq-data/m-p/254854#M9232</link>
      <description>&lt;P&gt;If you have already computed the frequencies for each bin, you can use the GTL HistogramParm statement. &amp;nbsp;But that statement is not available in SGPLOT. &amp;nbsp;However,&amp;nbsp;you can use the VBARPARM statement to create a histogram-like plot. &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=hist;&lt;BR /&gt; vbarparm category=x response=y / barwidth=1;&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/2209iC7AF8FD90F816992/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="Hist_Vbarparm.png" title="Hist_Vbarparm.png" /&gt;&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>Sun, 06 Mar 2016 18:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-histogram-with-freq-data/m-p/254854#M9232</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2016-03-06T18:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT histogram with freq data?</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-histogram-with-freq-data/m-p/254857#M9233</link>
      <description>&lt;P&gt;If you used PROC FREQ to tabulate the percentages, then presumably you are treating the data as discrete. As Sanjay points out, use a bar chart for discrete data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, if you want to use pre-tabulated data to create a histogram, you can do it but you need COUNTS rather than PERCENTAGES. PROC FREQ outputs counts, or if you know the total sample size you can create the counts, as follows;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A;
N = 100;
input x y;
count = N*y;  /* create counts from percentages */
datalines;
1 0.10
2 0.20
3 0.30
4 0.20
5 0.15
6 0.05
;

proc sgplot data=A;
histogram x / freq=count binwidth=1;
density x / freq=count type=kernel;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 06 Mar 2016 20:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-histogram-with-freq-data/m-p/254857#M9233</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2016-03-06T20:40:52Z</dc:date>
    </item>
  </channel>
</rss>

