<?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: Proc Ginside: Custom polygon in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Ginside-Custom-polygon/m-p/949655#M83754</link>
    <description>&lt;P&gt;Thanks for the prompt response. &amp;nbsp;I was looking for confirmation for what I already suspected to be the case. &amp;nbsp;I think I can figure it out from here....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Gene&lt;/P&gt;</description>
    <pubDate>Thu, 31 Oct 2024 19:51:33 GMT</pubDate>
    <dc:creator>genemroz</dc:creator>
    <dc:date>2024-10-31T19:51:33Z</dc:date>
    <item>
      <title>Proc Ginside: Custom polygon</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Ginside-Custom-polygon/m-p/949653#M83752</link>
      <description>&lt;P&gt;Does Proc Ginside require that the vertices of a custom polygon be ordered? &amp;nbsp;If so, what is the appropriate order? &amp;nbsp;Is there an easy way to accomplish this?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Gene&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 19:30:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Ginside-Custom-polygon/m-p/949653#M83752</guid>
      <dc:creator>genemroz</dc:creator>
      <dc:date>2024-10-31T19:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Ginside: Custom polygon</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Ginside-Custom-polygon/m-p/949654#M83753</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/299716"&gt;@genemroz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Does Proc Ginside require that the vertices of a custom polygon be ordered? &amp;nbsp;If so, what is the appropriate order? &amp;nbsp;Is there an easy way to accomplish this?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Gene&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Pretty much. To make sure a polygon is usable the last point on the perimeter must have the same coordinates as the first.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How to accomplish may depend. Can you provide more information? What sort of "custom polygon" do you envision?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically a data set with the coordinates and polygon id information .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ginside may not return your expected values if your custom polygon overlaps others. I seem to remember some difficulty with that but it has been a long time since that project.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 19:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Ginside-Custom-polygon/m-p/949654#M83753</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-10-31T19:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Ginside: Custom polygon</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Ginside-Custom-polygon/m-p/949655#M83754</link>
      <description>&lt;P&gt;Thanks for the prompt response. &amp;nbsp;I was looking for confirmation for what I already suspected to be the case. &amp;nbsp;I think I can figure it out from here....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Gene&lt;/P&gt;</description>
      <pubDate>Thu, 31 Oct 2024 19:51:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Ginside-Custom-polygon/m-p/949655#M83754</guid>
      <dc:creator>genemroz</dc:creator>
      <dc:date>2024-10-31T19:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Ginside: Custom polygon</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Ginside-Custom-polygon/m-p/949681#M83755</link>
      <description>&lt;P&gt;Yes. the sequence/order of scatter points to plot a polygon is important.&lt;/P&gt;
&lt;P&gt;Make sure you could get a right polygon by ploting these points one by one.&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*产生样本数据*/
data have;
  pi=constant('PI');
  call streaminit(123);
    do i=1 to 500;
      x=40+30*ranuni(2);  y=40+40*ranuni(2); output;
    end;

    /*--Add data all over--*/
    do i=1 to 100;
      x=400*ranuni(2);  y=400*ranuni(2); output;
    end;

    /*--Add data in the middle fan--*/
    do i=1 to 5000;
      x=40+360*ranuni(2);  
	  y=x+(x-50)*2*tan(pi/4 *ranuni(2) -pi/8);
	  y=ifn(y&amp;gt;400 or y&amp;lt;0, ., y);
      output;
    end;
	x=70;y=84;output;
    x=70;y=56;output;
 keep x y;
run;










/*画图*/
/*--Generate grid and point data--*/
data map;
infile cards expandtabs;
input n id $ x y;
cards;
1	E_L 180 0
2	E_L 180 70
3	E_L 400 70
4	E_L 400 0
40	E_U 0 180
41	E_U 70 180
42	E_U 70 400
43	E_U 0 400
8	D_L  240 70
9	D_L  240 180
10	D_L  400 180
11	D_L  400 70
35	D_U 0 70
36	D_U 58.3 70
37	D_U 70 84
38	D_U 70 180
39	D_U 0 180
5	C_L  130 0
6	C_L  180 70
7	C_L  180 0
32	C_U 70 180
33	C_U 290 400
34	C_U 70 400
12	B_L  70 0
13	B_L  70 56
14	B_L  400 320
15	B_L  400 180
16	B_L  240 180
17	B_L  240 70
18	B_L  180 70
19	B_L  130 0
28	B_U 70 84
29	B_U 333 400
30	B_U 290 400
31	B_U 70 180
20	A 0 0
21	A 0 70
22	A 58.3 70
23	A 333 400
24	A 400 400
25	A 400 320
26	A 70 56
27	A 70 0
;
run;
data map;
 set map;
 if n in (23 29) then x=400/1.2 ;
 if n in (22 36) then x=70/1.2 ;
 drop n;
run;



/*判断点在哪个区域*/
proc ginside data=have map=map out=id INCLUDEBORDER;
  id id ;
run;
data id;
 set id;
 id=scan(id,1,'_');
run;
/*特殊情况判断
data id;
 set id;
 if not missing(y) and not missing(x) then do;
  if (abs(y-x)/x*100)&amp;lt;=20 then id='A';
 end;
run;
*/
proc freq data=id ;
table id/out=zone;
run;

%let A=0.00;
%let B=0.00;
%let C=0.00;
%let D=0.00;
%let E=0.00;

%let count_A=0;
%let count_B=0;
%let count_C=0;
%let count_D=0;
%let count_E=0;

data _null_;
 set zone;
 if not missing(id) then do;
  call symputx(id,put(PERCENT,8.2));
  call symputx(cats('count_',id),COUNT);
 end;
run;



data Grid;
  /*--Zone A--*/
  id2=11; rfbg2=70;  sbg2=0; output;
  id2=11; rfbg2=70;  sbg2=56; output;
  id2=12; rfbg2=58.3;sbg2=70; output;
  id2=12; rfbg2=0;   sbg2=70; output;
  id2=13; rfbg2=70;   sbg2=84; output;
  id2=13; rfbg2=70;   sbg2=180; output;
  id2=13; rfbg2=0;   sbg2=180; output;

  /*--Zone E - Y--*/
  id2=3; rfbg2=70;  sbg2=180; output;
  id2=3; rfbg2=70;  sbg2=400; output;
  id2=3; rfbg2=0;   sbg2=400; output;
  /*--Zone E - X--*/
  id2=4; rfbg2=180;  sbg2=0; output;
  id2=4; rfbg2=180;  sbg2=70; output;
  id2=4; rfbg2=400;  sbg2=70; output;
  /*--Zone D - X--*/
  id2=5; rfbg2=240;  sbg2=70; output;
  id2=5; rfbg2=240;  sbg2=180; output;
  id2=5; rfbg2=400;  sbg2=180; output;
  /*--Zone C - Low--*/
  id2=6; rfbg2=130;  sbg2=0; output;
  id2=6; rfbg2=180;  sbg2=70; output;
  /*--Zone C - High--*/
  id2=7; rfbg2=70;  sbg2=180; output;
  id2=7; rfbg2=290; sbg2=400; output;
  /*--Zone B - High--*/
  id2=8; rfbg2=58.3; sbg2=70; output;
  id2=8; rfbg2=333.3;  sbg2=400; output;
  /*--Zone B - Low--*/
  id2=9; rfbg2=70;   sbg2=56; output;
  id2=9; rfbg2=400; sbg2=320; output;
  run;

data label;
length label $ 40;
    xl=20; yl=20; label='A';   output;
    xl=20; yl=120; label='D';  output;
    xl=20; yl=300; label='E';   output;
    xl=100; yl=20; label='B';   output;
    xl=160; yl=20; label='C';   output;
    xl=100; yl=160; label='B';   output;
    xl=320; yl=20; label="E(&amp;amp;count_E.,&amp;amp;E.%)";   output;
    xl=320; yl=120; label="D(&amp;amp;count_D.,&amp;amp;D.%)";  output;
    xl=320; yl=200; label="B(&amp;amp;count_B.,&amp;amp;B.%)" ; output;
    xl=340; yl=340; label="A(&amp;amp;count_A.,&amp;amp;A.%)" ; output;
    xl=120; yl=320; label="C(&amp;amp;count_C.,&amp;amp;C.%)" ; output;
run;


data plot;
 set Grid id label;
run;

/*--Attributes Map for zones--*/
data attrmap;
  length id $1 value $1 markercolor $10;
  id='A'; value='A'; markercolor='cx00afdf'; linecolor='cx00afdf'; output;
  id='A'; value='B'; markercolor='cx00ef7f'; linecolor='cx00ef7f'; output;
  id='A'; value='C'; markercolor='gray'; linecolor='gray'; output;
  id='A'; value='D'; markercolor='pink'; linecolor='pink'; output;
  id='A'; value='E'; markercolor='red'; linecolor='red'; output;
run;


/*--Draw the grid--*/
ods rtf file="c:\temp\clark.rtf" style=htmlblue dpi=300;
ods graphics / reset antialiasmax=5700 outputfmt=png;
proc sgplot data=plot noautolegend aspect=1 dattrmap=attrmap;
  scatter x=x y=y / attrid=A group=id  markerattrs=(symbol=circlefilled size=4 ) ;
  scatter x=xl y=yl / markerchar=label markercharattrs=(size=12)  ;
    series x=rfbg2 y=sbg2 / group=id2 lineattrs=(color=gray ) nomissinggroup;

  xaxis values=(0 to 400 by 50) offsetmin=0 offsetmax=0 label='Reference Blood Glucose';
  yaxis values=(0 to 400 by 50) offsetmin=0 offsetmax=0 label='Sensor Blood Glucose';
  run;
ods rtf close;
&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-1730427907868.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/101927iFAB8F9B8D6EE7C57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1730427907868.png" alt="Ksharp_0-1730427907868.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 02:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Ginside-Custom-polygon/m-p/949681#M83755</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-11-01T02:25:18Z</dc:date>
    </item>
  </channel>
</rss>

