<?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: Plotting proportions by groups in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-proportions-by-groups/m-p/226625#M8208</link>
    <description>&lt;P&gt;You can run PROC MEANS or some other procedure to get the proportions for each group and for each age group.&lt;/P&gt;&lt;P&gt;Then you can just use the SCATTER statement to plot the proportions against the age, using the GROUP= option to distinguish the groups.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* make up some data */
data Have;
set sashelp.class sashelp.class sashelp.class;
event = rand("bernoulli", logistic(1 - age/10));
run;

/* compute proportion for each age group and group */
proc means data=Have;
class sex age;
var event;
output out=out mean=Proportion;
run;

proc sgplot data=out;
WHERE _TYPE_=3;
scatter y=proportion x=age / group=sex;
run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 21 Sep 2015 18:21:18 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2015-09-21T18:21:18Z</dc:date>
    <item>
      <title>Plotting proportions by groups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-proportions-by-groups/m-p/226488#M8201</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data looking roughly like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Event: 0/1&lt;/P&gt;&lt;P&gt;Group: G1 / G2&lt;/P&gt;&lt;P&gt;AgeBin: 20-30/30-40/40-50/...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to plot the proportion of the event (proportion of 1's) for each group, by age bin. I though to put the age bins on the x-axis, the proportion on the y-axis, and for each age bin, to plot twp points, maybe with different shapes of markers, one for each group, and then I can see what happens to the difference between the groups when the age changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. How do I do that ? The data I specified is my variables as they are. I guess I need sgplots, but not sure how to do this task, it doesn't look straightforward.&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Is there a better representation that can suit my data ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance !&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 04:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-proportions-by-groups/m-p/226488#M8201</guid>
      <dc:creator>BlueNose</dc:creator>
      <dc:date>2015-09-21T04:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting proportions by groups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-proportions-by-groups/m-p/226568#M8203</link>
      <description>&lt;P&gt;Perhaps pre-summarize your data, and create a grouped bar chart, something like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://robslink.com/SAS/democd75/holiday_shopping_plans.htm" target="_blank"&gt;http://robslink.com/SAS/democd75/holiday_shopping_plans.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://robslink.com/SAS/democd75/holiday_shopping_plans_info.htm" target="_blank"&gt;http://robslink.com/SAS/democd75/holiday_shopping_plans_info.htm&lt;/A&gt;&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/261i8814559962B4A0D9/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="holiday_shopping_plans.png" title="holiday_shopping_plans.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 14:48:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-proportions-by-groups/m-p/226568#M8203</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2015-09-21T14:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting proportions by groups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-proportions-by-groups/m-p/226625#M8208</link>
      <description>&lt;P&gt;You can run PROC MEANS or some other procedure to get the proportions for each group and for each age group.&lt;/P&gt;&lt;P&gt;Then you can just use the SCATTER statement to plot the proportions against the age, using the GROUP= option to distinguish the groups.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* make up some data */
data Have;
set sashelp.class sashelp.class sashelp.class;
event = rand("bernoulli", logistic(1 - age/10));
run;

/* compute proportion for each age group and group */
proc means data=Have;
class sex age;
var event;
output out=out mean=Proportion;
run;

proc sgplot data=out;
WHERE _TYPE_=3;
scatter y=proportion x=age / group=sex;
run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Sep 2015 18:21:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-proportions-by-groups/m-p/226625#M8208</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2015-09-21T18:21:18Z</dc:date>
    </item>
  </channel>
</rss>

