<?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: Fun With SAS ODS Graphics: Circular Plot in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-Circular-Plot/m-p/877486#M23858</link>
    <description>&lt;P&gt;This is a nice effort! I am not a fan of circular plots, but if I ever want to use one, I will definitely use this code as a starting point.&amp;nbsp; Well done!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 May 2023 10:35:59 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2023-05-25T10:35:59Z</dc:date>
    <item>
      <title>Fun With SAS ODS Graphics: Circular Plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-Circular-Plot/m-p/877466#M23857</link>
      <description>&lt;P&gt;When I am looking at this Graph:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Graphics-Programming/Force-a-square-plot-space-in-a-rectangular-figure/m-p/877197#M23840" target="_blank"&gt; https://communities.sas.com/t5/Graphics-Programming/Force-a-square-plot-space-in-a-rectangular-figure/m-p/877197#M23840 &lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I think whether I can get it by PROC SGPLOT ?&lt;/P&gt;
&lt;P&gt;Yes. After working with PROC SGPLOT two hours, I got this picture.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
 set sashelp.heart(obs=1000);
 keep bp_status status sex;
run;

proc freq data=have noprint;
table status/out=freq1 list;
table status*sex/out=freq2 list;
table status*sex*bp_status/out=freq3 list;
run;


%macro circular_plot(dataset_in=,id=);
data temp;
 set &amp;amp;dataset_in.;
 id+1;id=1000*&amp;amp;id.+id;
 pi=PERCENT*0.01*2*constant('pi');
 cum_pi+pi;
 lag_cum_pi=lag(cum_pi);
 if _n_=1 then lag_cum_pi=0;
run;
data plot;
 set temp;
 /*for a Polygon*/
 do _pi=lag_cum_pi to cum_pi by 0.001; 
 x=&amp;amp;id.*cos(_pi);y=&amp;amp;id.*sin(_pi);output;
 end;
 x=&amp;amp;id.*cos(_pi);y=&amp;amp;id.*sin(_pi);output;

 do _pi=cum_pi to lag_cum_pi by -0.001; 
 x=%eval(&amp;amp;id.+1)*cos(_pi);y=%eval(&amp;amp;id.+1)*sin(_pi);output;
 end;
 x=%eval(&amp;amp;id.+1)*cos(_pi);y=%eval(&amp;amp;id.+1)*sin(_pi);output;

keep x y id ;
run;

%CENTROID (plot, sgplot, id)

data want;
merge plot sgplot(rename=(x=centroid_x y=centroid_y)) temp(keep=id count) ;
by id;
output;
call missing(of _all_);
run;

proc append base=final_want data=want force;run;
%mend;


proc delete data=final_want;run;
%circular_plot(dataset_in=freq1,id=1)
%circular_plot(dataset_in=freq2,id=2)
%circular_plot(dataset_in=freq3,id=3)

/*
data temp;
x2=0;y2=1.5;label='Alive or Death';output;
x2=0;y2=2.5;label='Sex';output;
x2=0;y2=3.5;label='Blood Pressure';output;
run;
data final_want2;
 set final_want temp;
run;
*/
ods graphics/ANTIALIASMAX=1000000 ;
proc sgplot data=final_want aspect=1 noautolegend noborder;
polygon x=x y=y id=id/fill outline  lineattrs=(color=white thickness=2) group=id;
scatter x=centroid_x y=centroid_y/markerchar=count markercharattrs=(size=10) labelstrip;
/*scatter x=x2 y=y2/markerchar=label markercharattrs=(size=14 color=white weight=bold) labelstrip;*/
xaxis offsetmin=0 offsetmax=0 display=none;
yaxis offsetmin=0 offsetmax=0 display=none;
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-1685005422382.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84307iD7E4C36B1A05B343/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1685005422382.png" alt="Ksharp_0-1685005422382.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 09:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-Circular-Plot/m-p/877466#M23857</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-05-25T09:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Fun With SAS ODS Graphics: Circular Plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-Circular-Plot/m-p/877486#M23858</link>
      <description>&lt;P&gt;This is a nice effort! I am not a fan of circular plots, but if I ever want to use one, I will definitely use this code as a starting point.&amp;nbsp; Well done!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 10:35:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Fun-With-SAS-ODS-Graphics-Circular-Plot/m-p/877486#M23858</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-05-25T10:35:59Z</dc:date>
    </item>
  </channel>
</rss>

