<?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 plot top ten causes of death in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-top-ten-causes-of-death/m-p/479814#M16579</link>
    <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to plot the top ten causes of death for 3 groups of my study population. Below is an example of what I want to get at the&lt;/P&gt;&lt;P&gt;end but for 3 groups (instead of eight) and ten diseases (instead of five). Attached is the dataset containing study participant&amp;nbsp;ID, causes&amp;nbsp;and patient groups.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if someone could help me how I should go about it?&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="COD.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21885i7CA90ACB3B006AAB/image-size/large?v=v2&amp;amp;px=999" role="button" title="COD.JPG" alt="COD.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jul 2018 06:39:25 GMT</pubDate>
    <dc:creator>SAS--_lover</dc:creator>
    <dc:date>2018-07-20T06:39:25Z</dc:date>
    <item>
      <title>How to plot top ten causes of death</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-top-ten-causes-of-death/m-p/479814#M16579</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to plot the top ten causes of death for 3 groups of my study population. Below is an example of what I want to get at the&lt;/P&gt;&lt;P&gt;end but for 3 groups (instead of eight) and ten diseases (instead of five). Attached is the dataset containing study participant&amp;nbsp;ID, causes&amp;nbsp;and patient groups.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if someone could help me how I should go about it?&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="COD.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21885i7CA90ACB3B006AAB/image-size/large?v=v2&amp;amp;px=999" role="button" title="COD.JPG" alt="COD.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 06:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-top-ten-causes-of-death/m-p/479814#M16579</guid>
      <dc:creator>SAS--_lover</dc:creator>
      <dc:date>2018-07-20T06:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot top ten causes of death</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-top-ten-causes-of-death/m-p/479872#M16581</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's how I would make it.&amp;nbsp; This would require SAS 9.4 but there are ways to do it earlier as well.&amp;nbsp; I set it up to make the blocks with the HIGHLOW plot and showed the order with an XAXISTABLE.&amp;nbsp; I made up an age format for your group variable, so you can make your own for that.&amp;nbsp; The text is plotted with a TEXTPLOT and I use the ` symbol to force a split in the text for the longer ones.&amp;nbsp; Note the file paths would need to be changed.&amp;nbsp; You can set up a STYLEATTRS statement to modify your colors for the text or blocks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import file='~/ibm/Death_group.csv' dbms=csv out=dat replace;
run;

proc sort data=dat;
    by group;
run;


proc freq data=dat noprint;
    by group;
    table cause / out=frq;
run;
proc sort data=frq;
    by group descending count;
run;
proc format;
    value groupf
        0 ='20-30'
        1 ='30-40'
        2 ='40-50' 
        other=' ';
run;
data plot;
    set frq;
    by group;
    
    if first.group then do;
        order=0.5;
        low=0.05;
    end;
    else do;
        low+1;
        order+1;
    end;
    if group=0 then do;
        if ceil(order)=1 then orderf='1st';
        else if ceil(order)=2 then orderf='2nd';
        else if ceil(order)=3 then orderf='3rd';
        else if ceil(order)=4 then orderf='4th';
        else if ceil(order)=5 then orderf='5th';
        else if ceil(order)=6 then orderf='6th';
        else if ceil(order)=7 then orderf='7th';
        else if ceil(order)=8 then orderf='8th';
        else if ceil(order)=9 then orderf='9th';
    end;
    high=low+0.9;
    
    if cause='Cerebrovascular diseases' then cause='Cerebrovascular`diseases';
    else if cause='Heart diseases: IHDs + others' then cause='Heart diseases:`IHDs + others';
    else if cause='influenza/ pneumonia' then cause='influenza/`pneumonia';
run;
ods listing gpath='~/ibm/';
ods graphics / reset width=15in height=4in;
proc sgplot data=plot nowall noborder noautolegend;
    scatter x=order y=group / markerattrs=(size=0pt);
    highlow low=low high=high y=group / group=cause x2axis type=bar barwidth=0.9;
    text y=group x=order text=cause / position=center strip textattrs=(size=12pt) splitchar='`' splitpolicy=splitalways;
    xaxistable orderf / position=top x=order location=inside label='Age Group' labelattrs=(size=12pt) valueattrs=(size=12pt);
    yaxis type=linear label='Group' min=-0.5 max=2.5  tickvalueformat=groupf.  reverse display=(nolabel noticks noline) offsetmin=0 offsetmax=0;
    xaxis type=linear min=0 max=9 display=none offsetmin=0 offsetmax=0;
    x2axis type=linear min=0 max=9 display=none offsetmin=0 offsetmax=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21888i95FCF0E790BD090B/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot.png" alt="SGPlot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 14:07:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-top-ten-causes-of-death/m-p/479872#M16581</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2018-07-20T14:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot top ten causes of death</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-top-ten-causes-of-death/m-p/479884#M16582</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/145985"&gt;@SAS--_lover&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to plot the top ten causes of death for 3 groups of my study population. Below is an example of what I want to get at the&lt;/P&gt;
&lt;P&gt;end but for 3 groups (instead of eight) and ten diseases (instead of five). Attached is the dataset containing study participant&amp;nbsp;ID, causes&amp;nbsp;and patient groups.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was wondering if someone could help me how I should go about it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you want a table or a plot? Plot usually refers to a graphic and that does not appear to be a graph.&lt;/P&gt;
&lt;P&gt;If the desire is a colored table similar to what you show you might indicate any rules involved.&lt;/P&gt;
&lt;P&gt;Also do you want done if there are ties for top 3? Such as 2nd, 3rd and 4th all have the same frequency for a group?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 14:15:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-top-ten-causes-of-death/m-p/479884#M16582</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-07-20T14:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to plot top ten causes of death</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-top-ten-causes-of-death/m-p/480001#M16584</link>
      <description>&lt;P&gt;It took a bit of custom coding, but here's a SAS graph on the topic:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://robslink.com/SAS/democd33/death_odds.htm" target="_blank"&gt;http://robslink.com/SAS/democd33/death_odds.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://robslink.com/SAS/democd33/death_odds_info.htm" target="_blank"&gt;http://robslink.com/SAS/democd33/death_odds_info.htm&lt;/A&gt;&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="death_odds.png" style="width: 505px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21891iDC43917AB986814C/image-size/large?v=v2&amp;amp;px=999" role="button" title="death_odds.png" alt="death_odds.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2018 18:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-plot-top-ten-causes-of-death/m-p/480001#M16584</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2018-07-20T18:07:45Z</dc:date>
    </item>
  </channel>
</rss>

