<?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: Graph with risk in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861734#M23552</link>
    <description>&lt;P&gt;What version of sas you are using ?&lt;BR /&gt;Mine is SAS 9.4M7 .&lt;BR /&gt;If your sas is too old, you could try free version:&lt;BR /&gt;&lt;A href="https://welcome.oda.sas.com/" target="_blank"&gt;https://welcome.oda.sas.com/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I didn't get any error info in my log.&lt;BR /&gt;You'd better post your full LOG.&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="Ksharp_0-1677678873069.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80991i71323CE533ABE47E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1677678873069.png" alt="Ksharp_0-1677678873069.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2023 13:54:51 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2023-03-01T13:54:51Z</dc:date>
    <item>
      <title>Graph with risk</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861088#M23531</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found a part of the program, but I can't reproduce the attached chart.&lt;BR /&gt;I'm not a good programmer and therefore I have some difficulty finding the solution, can I ask you for help?&lt;BR /&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;proc sgplot data=tmp2 dattrmap=AttrMap nocycleattrs sganno=anno;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; /* This syntax plots the incidence lines on LHS */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; highlow y=cat high=rate low=zero / group=group type=bar groupdisplay=cluster name='a'&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lowlabel=IRLAB barwidth=1.0 clusterwidth=0.9 transparency=0 fill attrid=group&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataskin=pressed LABELATTRS= (size=8pt weight=normal family='Albany AMT') nooutline;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; /* This syntax plots background shading */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; highlow y=cat high=xmax low=rate1 / group=brtyp type=bar groupdisplay=cluster&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; barwidth=1.0 clusterwidth=0.9 transparency=0.70 fill attrid=brtyp nooutline;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; /* This syntax plots the words Benefits and Risks at the respective y axis posotions */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; highlow y=cat high=defx low=defx / type=bar highlabel=BRTXT barwidth=0 transparency=0 fill&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;LABELATTRS= (size=20pt weight=normal family='Albany AMT') nooutline;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; /* This syntax plots the risk difference with error bars on RHS */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; scatter y=cat2 x=rd /group=subg xerrorlower=rdlo xerrorupper=rdhi&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; x2axis y2axis attrid=subg;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; /* Axis limits (0 to 50; -8 to &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; might need to be adjusted depending on data */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; refline 50 / axis=x;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; refline 0 /axis=x2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; xaxis display=(nolabel) offsetmax=0.60 grid values=(0 to 50 by 10) valueattrs=(size=7);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; yaxis display=(nolabel) valueattrs=(size=9 family='Albany AMT') type=discrete&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fitpolicy=splitalways splitchar="#";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; x2axis display=(nolabel) offsetmin=0.42 grid max=64 values=(-10 to 10 by 2) valueattrs=(size=7);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; y2axis display=(nolabel noticks novalues) values=(1 to 10 by 1) type=linear;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; keylegend 'a';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 13:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861088#M23531</guid>
      <dc:creator>GiuseppeC</dc:creator>
      <dc:date>2023-02-27T13:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: Graph with risk</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861127#M23540</link>
      <description>&lt;P&gt;Data, can't test code without data. Also you should paste text into a text box opened on the forum with the &amp;lt;/&amp;gt; icon that appears above the message window. If you look at your post some combination of characters have been turned into an emoji which is just one of the ways the forum software will reformat pasted text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The percent column would likely be done with a YAXIS table, depending on the content of your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't say which part(s) of the graph you are having problems with so it is extremely hard to tell what changes to code may be needed. And as I mentioned, we can't test a solution without data. Often a change to the data is needed for specific plots.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;/&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 16:07:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861127#M23540</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-27T16:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Graph with risk</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861339#M23541</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
Your Statistic Graph is from here:
https://blogs.sas.com/content/graphicallyspeaking/2016/08/27/clinical-graphs-risk-difference-plots/
*/
data have;
input a $ b  v label $ x  rdiff rdiff_l rdiff_u;
cards;
A|A 1 15.5 . . -5 -6.5 -2.5
A|A 2 10.7 . . . . .
A|B 1 21.0 Benefits 50  -4 -4.5 -2
A|B 2 17.1 . . . . .
A|C 1 17.0 . . -4 -4.5 -2
A|C 2 13.1 . . . . .
A|D 1 39.5 . . -2.5 -5 -0.5
A|D 2 36.7 . . . . .
A|E 1 26.9 . . -2.5 -5 -1
A|E 2 23.8 . . . . .
A|F 1 16.1 . . -4 -4.8 -2.2
A|F 2 12.0 . . . . .
B|A 1 16.7 . . 1 -0.5 2.5
B|A 2 17.9 . . . . .
B|B 1 16.7 . . 2 0.8 4.2
B|B 2 20.0 Risks 50 . . .
B|C 1 13.6 . . -1.8 -2.8 -0.1
B|C 2 11.9 . . . . .
B|D 1 0.7  . . 1 0 1.4
B|D 2 1.1  . . . . .
;

proc format;
value fmt
1='Drug A'
2='Conparator'
;
run;


proc sgplot data=have;
format b fmt.;
label v='(%)';
styleattrs datacolors=( navy purple ) ;
refline "A|A" "A|C" "A|E" /axis=y LINEATTRS=(thickness=32 color=yellow) transparency=0.8;
refline "A|B" "A|D" "A|F" /axis=y LINEATTRS=(thickness=32 color=orange) transparency=0.8;
refline "B|A" "B|C" /axis=y LINEATTRS=(thickness=32 color=grey) transparency=0.8;
refline "B|B" "B|D" /axis=y LINEATTRS=(thickness=32 color=black) transparency=0.8;
refline 50/ axis=x LINEATTRS=(color=gray);
refline 0/ axis=x2 LINEATTRS=(color=gray);
refline 5/ axis=x2 LINEATTRS=(thickness=0) label="Comparator better|(*ESC*){unicode '2192'x}" splitchar='|';
refline -5/ axis=x2 LINEATTRS=(thickness=0) label="Durg A better|(*ESC*){unicode '2190'x}" splitchar='|';

hbarparm category=a response=v/group=b groupdisplay=cluster dataskin=pressed name='a';
scatter x=x y=a/datalabel=label datalabelpos=left markerattrs=(size=0) datalabelattrs=(size=12 weight=bold) ;
scatter x=rdiff y=a/xerrorlower=rdiff_l xerrorupper=rdiff_u x2axis
                    markerattrs=(symbol=squarefilled color=black) errorbarattrs=(color=black);

yaxistable v/y=a class=b classdisplay=cluster colorgroup=b position=left location=inside VALUEATTRS=(weight=bold);
yaxis label=' ' splitchar='|' splitjustify=right fitpolicy=splitalways offsetmin=0.05 offsetmax=0.05 ;
xaxis label="Incidence(%) %sysfunc(repeat(%str(  ),40))"
  values=(0 to 50 by 10) grid offsetmin=0 offsetmax=0.5 ;
x2axis label="%sysfunc(repeat(%str(  ),32)) RiskDiff and 95% CI[%](Drug A vs Conparator)"
  values=(-10 to 10 by 2) grid offsetmin=0.5 offsetmax=0 ;
keylegend 'a'/title='';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1677584504254.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80926i3C396BD193B9C03C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1677584504254.png" alt="Ksharp_0-1677584504254.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 11:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861339#M23541</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-02-28T11:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Graph with risk</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861382#M23542</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;BR /&gt;Sorry if I didn't attach the data.&lt;BR /&gt;In practice I didn't have a database to show, I thought that the graph could be generated by generating a fancy DB.&lt;BR /&gt;I have attached the program that I had found on the internet and I thought it would make programming easier.&lt;BR /&gt;I'll be more careful next time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 14:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861382#M23542</guid>
      <dc:creator>GiuseppeC</dc:creator>
      <dc:date>2023-02-28T14:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Graph with risk</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861387#M23543</link>
      <description>&lt;P&gt;Thanks for the program.&lt;BR /&gt;I tried to run it, but in the Log it gives me an error for the instruction groupdisplay=cluster and classdisplay=cluster.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 14:16:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861387#M23543</guid>
      <dc:creator>GiuseppeC</dc:creator>
      <dc:date>2023-02-28T14:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Graph with risk</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861734#M23552</link>
      <description>&lt;P&gt;What version of sas you are using ?&lt;BR /&gt;Mine is SAS 9.4M7 .&lt;BR /&gt;If your sas is too old, you could try free version:&lt;BR /&gt;&lt;A href="https://welcome.oda.sas.com/" target="_blank"&gt;https://welcome.oda.sas.com/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I didn't get any error info in my log.&lt;BR /&gt;You'd better post your full LOG.&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="Ksharp_0-1677678873069.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80991i71323CE533ABE47E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1677678873069.png" alt="Ksharp_0-1677678873069.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 13:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/861734#M23552</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-03-01T13:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Graph with risk</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/862036#M23558</link>
      <description>&lt;P&gt;Dear Ksharp,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks you wholeheartedly.&lt;/P&gt;&lt;P&gt;The problem was my SAS version which I have now updated and your program is perfect.&lt;BR /&gt;You have been very kind.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 21:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Graph-with-risk/m-p/862036#M23558</guid>
      <dc:creator>GiuseppeC</dc:creator>
      <dc:date>2023-03-02T21:20:16Z</dc:date>
    </item>
  </channel>
</rss>

