<?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 How to put two distribution curve together in Proc univariate in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44050#M1453</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use proc univaraiate to draw the distribution curve and histogram of two different groups of data by the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc univariate data=data noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; histogram money /cfill=ligr normal cframe=liy barwidth=8 cv=black;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY location;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know how to put curves generated in the by statement together in one graph.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Feb 2012 14:08:20 GMT</pubDate>
    <dc:creator>iusing</dc:creator>
    <dc:date>2012-02-02T14:08:20Z</dc:date>
    <item>
      <title>How to put two distribution curve together in Proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44050#M1453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I use proc univaraiate to draw the distribution curve and histogram of two different groups of data by the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc univariate data=data noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; histogram money /cfill=ligr normal cframe=liy barwidth=8 cv=black;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BY location;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know how to put curves generated in the by statement together in one graph.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 14:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44050#M1453</guid>
      <dc:creator>iusing</dc:creator>
      <dc:date>2012-02-02T14:08:20Z</dc:date>
    </item>
    <item>
      <title>How to put two distribution curve together in Proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44051#M1454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can get a COMPARATIVE panel of histograms by using the CLASS stmt instead of the BY stmt: CLASS location;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this isn't sufficient, then I ask whether you just want the normal curves by themselves (in a single plot), or whether you want the densities fpor each group overlaid on a histogram.&amp;nbsp; If on a histogram, then are you asking for the histogram of ALL the data, across all groups? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 15:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44051#M1454</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-02-02T15:01:41Z</dc:date>
    </item>
    <item>
      <title>How to put two distribution curve together in Proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44052#M1455</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, I just want the normal curves, how can I put into one graph to do the comparison&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 15:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44052#M1455</guid>
      <dc:creator>iusing</dc:creator>
      <dc:date>2012-02-02T15:22:06Z</dc:date>
    </item>
    <item>
      <title>How to put two distribution curve together in Proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44053#M1456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do this using SGPLOT procedure.&amp;nbsp; If this is what you need, I can attach the code.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="ComparativeDensitiy.png" class="jive-image-thumbnail jive-image" onclick="" src="https://communities.sas.com/legacyfs/online/1449_ComparativeDensitiy.png" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 15:25:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44053#M1456</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2012-02-02T15:25:29Z</dc:date>
    </item>
    <item>
      <title>How to put two distribution curve together in Proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44054#M1457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yup &lt;/P&gt;&lt;P&gt;how to draw it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 15:26:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44054#M1457</guid>
      <dc:creator>iusing</dc:creator>
      <dc:date>2012-02-02T15:26:53Z</dc:date>
    </item>
    <item>
      <title>How to put two distribution curve together in Proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44055#M1458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way is to transpose the data so that each category become a variable, and then use the SGPLOT DENSITY stmt.&lt;/P&gt;&lt;P&gt;To transpose the data, see &lt;A href="http://blogs.sas.com/content/iml/2011/11/04/reshape-data-so-that-each-category-becomes-a-new-variable/"&gt;http://blogs.sas.com/content/iml/2011/11/04/reshape-data-so-that-each-category-becomes-a-new-variable/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data combo;&lt;BR /&gt; keep Females Males;&lt;BR /&gt; merge sashelp.class(where=(sex="F") rename=(height=Females))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sashelp.class(where=(sex="M") rename=(height=Males));&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sgplot data=combo;&lt;BR /&gt;density Females / legendlabel="Female";&lt;BR /&gt;density Males / legendlabel="Male";&lt;BR /&gt;xaxis label="Height";&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 15:30:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44055#M1458</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-02-02T15:30:58Z</dc:date>
    </item>
    <item>
      <title>How to put two distribution curve together in Proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44056#M1459</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This solution uses PROC SGPLOT's DENSITY statements.&amp;nbsp; Transform the data into multiple columns (one per class) and then use multiple density plots. I just used a data step with SASHELP.CARS to do that, but you can likely use proc transpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*--Sort the data--*/&lt;/P&gt;&lt;P&gt; proc sort data=sashelp.cars out=cars;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by origin;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*--Separate the class data into multiple columns--*/&lt;/P&gt;&lt;P&gt;data cars1 cars2 cars3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set cars (keep=mpg_city origin);&lt;/P&gt;&lt;P&gt;&amp;nbsp; if origin='USA' then do; mpg_usa=mpg_city; output cars1; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if origin='Asia' then do; mpg_asia=mpg_city; output cars2; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if origin='Europe' then do; mpg_eur=mpg_city; output cars3; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*--Merge data into one data set--*/&lt;/P&gt;&lt;P&gt;data MpgByOrigin;&lt;/P&gt;&lt;P&gt;&amp;nbsp; merge cars1(keep=mpg_usa) cars2(keep=mpg_asia) cars3(keep=mpg_eur);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*--Create graph using SGPLOT--*/&lt;/P&gt;&lt;P&gt;title 'Milage Distribution by Origin';&lt;/P&gt;&lt;P&gt;proc sgplot data=mpgbyorigin;&lt;/P&gt;&lt;P&gt;&amp;nbsp; density mpg_usa / legendlabel='USA' lineattrs=(pattern=solid);&lt;/P&gt;&lt;P&gt;&amp;nbsp; density mpg_asia&amp;nbsp; / legendlabel='Asia' lineattrs=(pattern=solid);&lt;/P&gt;&lt;P&gt;&amp;nbsp; density mpg_eur&amp;nbsp; / legendlabel='Europe' lineattrs=(pattern=solid);&lt;/P&gt;&lt;P&gt;&amp;nbsp; keylegend / location=inside position=topright across=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; xaxis display=(nolabel);&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Feb 2012 15:35:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-put-two-distribution-curve-together-in-Proc-univariate/m-p/44056#M1459</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2012-02-02T15:35:37Z</dc:date>
    </item>
  </channel>
</rss>

