<?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: SAS SG Plot Procedure in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785139#M22404</link>
    <description>&lt;P&gt;LOL - We both 'cheated' in that neither of us used Proc SGplot! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Dec 2021 12:24:37 GMT</pubDate>
    <dc:creator>GraphGuy</dc:creator>
    <dc:date>2021-12-09T12:24:37Z</dc:date>
    <item>
      <title>SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/784858#M22397</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;Here is my data I need to represent the below data into the figure:&lt;/P&gt;
&lt;P&gt;Data:X&lt;BR /&gt;&lt;U&gt;Row&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;trt01&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;timepoint&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; grade&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;percent&lt;/U&gt;&lt;BR /&gt;Pain&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;day1,30 min&amp;nbsp; &amp;nbsp;mild&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 33.3&lt;BR /&gt;Pain&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;day1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;moderate&amp;nbsp; &amp;nbsp;40.2&lt;BR /&gt;Pain&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;day1,30 min&amp;nbsp; &amp;nbsp;moderate&amp;nbsp; &amp;nbsp; 24.0&lt;BR /&gt;Pain&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;day1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;mild&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 35.0&lt;BR /&gt;Pain&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;day1,30 min&amp;nbsp; &amp;nbsp; moderate&amp;nbsp; &amp;nbsp;44.0&lt;BR /&gt;Pain&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;day1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mild&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;35.0&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;On the x-axis I need to display three treatment groups(trt01a) with severity grade which need to be a clustered or adjacent group bar on each timepoint. Each treatment should display there severity grade. On the x-axis I want to display(key legend) grade as below figure along with I want to display treatment group with varies color option&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Here is the figure which I need : Iam using SG plot procedure but somehow I was not able to generate grouped bars with treatment groups at each time point. Do I need to use any other proc procedure. Could you please help me in providing the code with an example&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mounikag_0-1638955476162.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66497i0F87A40C57EF7F37/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mounikag_0-1638955476162.png" alt="mounikag_0-1638955476162.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;on X-axis key legend should be :&lt;/P&gt;
&lt;P&gt;Pain: Grade Mild moderate Severe&lt;/P&gt;
&lt;P&gt;Trt&amp;nbsp; :&amp;nbsp; a&amp;nbsp; b c&lt;BR /&gt;&lt;BR /&gt;I am using below SG plot Procedure to output the figure and here is the code:&lt;BR /&gt;proc sgplot data=x dattrmap=attrmap;&lt;BR /&gt;by trtn rowlbl;&lt;/P&gt;
&lt;P&gt;vbar tptn / response=percent group=grade name="Param" barwidth=0.5 attrid=rowlbl;&lt;/P&gt;
&lt;P&gt;vbar tptn / response=percent group=trt groupdisplay=cluster name="Param" barwidth=0.5 attrid=rowlbl;&lt;/P&gt;
&lt;P&gt;xaxis label='Timepoints' valueattrs=(size=8) values=(0 to valuesdisplay=('Day 1 30 Min' 'Day 1 PM' 'Day 2' 'Day 3' 'Day 4' 'Day 5' 'Day 6' 'Day 7' ); *valuesformat=atpt.;* fitpolicy=rotatethin;&lt;/P&gt;
&lt;P&gt;yaxis values=(0 to 100 by 10) label='Percentage of Subjects with Reactions' ;&lt;/P&gt;
&lt;P&gt;keylegend "Param"/ title=&amp;amp;title. location=outside position=bottom across=9 sortorder=ascending;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 09:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/784858#M22397</guid>
      <dc:creator>mounikag</dc:creator>
      <dc:date>2021-12-08T09:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785065#M22400</link>
      <description>&lt;P&gt;Here's one way to do it with SAS/Graph Proc Gchart, with a partial dataset I created (I'll leave it to the ODS Graphics experts to show how to do it with Proc SGplot) &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
infile datalines pad truncover dlm=':';
length trt01 $3 timepoint $15 grade $10;
input trt01 timepoint grade percent;
datalines;
a:day 1, 30 min:mild:34
a:day 1, 30 min:moderate:2
a:day 1, 30 min:severe:0
b:day 1, 30 min:mild:64
b:day 1, 30 min:moderate:0
b:day 1, 30 min:severe:0
c:day 1, 30 min:mild:15.0
c:day 1, 30 min:moderate:0
c:day 1, 30 min:severe:0
a:day 1, PM:mild:62
a:day 1, PM:moderate:14
a:day 1, PM:severe:0
b:day 1, PM:mild:45
b:day 1, PM:moderate:37
b:day 1, PM:severe:0
c:day 1, PM:mild:15.0
c:day 1, PM:moderate:5
c:day 1, PM:severe:0
a:day 2:mild:78
a:day 2:moderate:11
a:day 2:severe:4
b:day 2:mild:27
b:day 2:moderate:30
b:day 2:severe:0
c:day 2:mild:15.0
c:day 2:moderate:5
c:day 2:severe:0
run;

axis1 minor=none label=(angle=90 'Percentage of Subjects with Reactions');
axis2 label=none value=none;
axis3 label=none;
legend1 label=("GRADE") shape=bar(.15in,.15in) frame;

proc gchart data=x;
vbar trt01 / sumvar=percent subgroup=grade space=0
 group=timepoint maxis=axis2 gaxis=axis3 legend=legend1
 raxis=axis1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="group_bar.png" style="width: 587px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66540iAB0751869AC45122/image-size/large?v=v2&amp;amp;px=999" role="button" title="group_bar.png" alt="group_bar.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 04:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785065#M22400</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2021-12-09T04:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785133#M22403</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
infile datalines pad truncover dlm=':';
length trt01 $3 timepoint $15 grade $10;
input trt01 timepoint grade percent;
datalines;
a:day 1, 30 min:mild:34
a:day 1, 30 min:moderate:2
a:day 1, 30 min:severe:0
b:day 1, 30 min:mild:64
b:day 1, 30 min:moderate:0
b:day 1, 30 min:severe:0
c:day 1, 30 min:mild:15.0
c:day 1, 30 min:moderate:0
c:day 1, 30 min:severe:0
a:day 1, PM:mild:62
a:day 1, PM:moderate:14
a:day 1, PM:severe:0
b:day 1, PM:mild:45
b:day 1, PM:moderate:37
b:day 1, PM:severe:0
c:day 1, PM:mild:15.0
c:day 1, PM:moderate:5
c:day 1, PM:severe:0
a:day 2:mild:78
a:day 2:moderate:11
a:day 2:severe:4
b:day 2:mild:27
b:day 2:moderate:30
b:day 2:severe:0
c:day 2:mild:15.0
c:day 2:moderate:5
c:day 2:severe:0
;


proc sgpanel data=x ;
panelby  timepoint/onepanel layout=COLUMNLATTICE novarname 
    NOBORDER COLHEADERPOS=bottom HEADERBACKCOLOR=white NOHEADERBORDER;
vbar trt01/response=percent group=grade barwidth=1 nostatlabel;
colaxis display=none;
rowaxis values=(0 to 100 by 10) label='Percentage of Subjects with Reactions';
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-1639050940616.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66559i3CE475D3B48469E7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1639050940616.png" alt="Ksharp_0-1639050940616.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 11:55:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785133#M22403</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-09T11:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785139#M22404</link>
      <description>&lt;P&gt;LOL - We both 'cheated' in that neither of us used Proc SGplot! &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 12:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785139#M22404</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2021-12-09T12:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785140#M22405</link>
      <description>Agree ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;Anybody want try by PROC SGPLOT ?</description>
      <pubDate>Thu, 09 Dec 2021 12:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785140#M22405</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-12-09T12:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785151#M22406</link>
      <description>&lt;P&gt;SGPANEL is the right way to create this graph with cluster groups and stacked groups among the ODS graphics tools.&amp;nbsp; SGPLOT does not handle this case easily.&amp;nbsp; One could try to force using SGPLOT using multiple VBAR statements with DISCRETEOFFSETs, but it easier with SGPANEL (or GCHART).&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 14:24:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/785151#M22406</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2021-12-09T14:24:39Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790236#M22492</link>
      <description>&lt;P&gt;Thanks for your response&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 20:05:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790236#M22492</guid>
      <dc:creator>mounikag</dc:creator>
      <dc:date>2022-01-14T20:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790237#M22493</link>
      <description>Hi Ksharp,&lt;BR /&gt;&lt;BR /&gt;It worked . Thanks alot for your help and response . I just want need one addition to the figure .. I want to display number of subjects on each bar at particular time point . I know how to display in sgplot by using datalabels but how do i need to use in sgpanel to genearte number of subjects on each bar ..&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jan 2022 20:09:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790237#M22493</guid>
      <dc:creator>mounikag</dc:creator>
      <dc:date>2022-01-14T20:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790244#M22494</link>
      <description>&lt;P&gt;SGPANEL supports the DATALABEL option like SGPLOT; but, in this case, that option will not work, as the grouped bars are "stacked" (as opposed to "clustered". You have a couple of options:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Use the SEGLABEL option to display the value in each bar segment&lt;/LI&gt;
&lt;LI&gt;Pre-summarize the data and use VBARPARM instead of VBAR. Then, you can overlay a TEXT plot to put the values on the ends of the bars&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;If you need more information about the latter, let me know.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 20:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790244#M22494</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-01-14T20:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790250#M22495</link>
      <description>Thanks danh_s for quick turn around. Iam trying to use as suggested but is not displaying. here is my code .please let me know if iam doing wrong&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc sgpanel data=final dattrmap=attrmap ;&lt;BR /&gt;  by rowlbl;&lt;BR /&gt;  panelby tptn / layout=columnlattice&lt;BR /&gt;		onepanel noborder &lt;BR /&gt;		colheaderpos=bottom spacing=10 ;&lt;BR /&gt;  format tptn tptf.; &lt;BR /&gt;  vbarparm category=trtn  response=percent/ group=grade  displaybaseline=auto datalabel=nsubjs dataskin=pressed;;&lt;BR /&gt;/*  vbar tptn / datalabel=nsubjs nofill;*/&lt;BR /&gt;  format trtn trtf.;&lt;BR /&gt;  colaxis display=(nolabel);&lt;BR /&gt;  rowaxis values=(0 to 100 by 10) label='Percentage of Subjects with Reactions' ;&lt;BR /&gt;  keylegend /border;&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Fri, 14 Jan 2022 20:53:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790250#M22495</guid>
      <dc:creator>mounikag</dc:creator>
      <dc:date>2022-01-14T20:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790252#M22496</link>
      <description>&lt;P&gt;DATALABEL will still not work due to the stacked bars. That is why you will need to add the TEXT plot. You code will look something like the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;vbarparm category=trtn response=percent/ group=grade displaybaseline=auto dataskin=pressed;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;text x=trtn y=percent text=nsubjs / position=top pad=(bottom=5px) contributeoffsets=none;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 21:02:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790252#M22496</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2022-01-14T21:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS SG Plot Procedure</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790263#M22497</link>
      <description>&lt;P&gt;Thank U so much it worked . But i need some cosmetic change where I need a space between each treatment within a panel. Here is my code iam using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgpanel data=final dattrmap=attrmap ;&lt;BR /&gt;by rowlbl;&lt;BR /&gt;panelby tptn / layout=columnlattice&lt;BR /&gt;onepanel noborder novarname&lt;BR /&gt;colheaderpos=bottom spacing=10 proportional;&lt;BR /&gt;format tptn tptf.;&lt;/P&gt;
&lt;P&gt;vbarparm category=trtn response=percent/ group=grade datalabel=nsubjs groupdisplay=cluster &lt;BR /&gt;barwidth=1.0 DATALABELFITPOLICY=NONE DATALABELATTRS=(size=9);&lt;/P&gt;
&lt;P&gt;format trtn trtf.;&lt;BR /&gt;colaxis display=(nolabel);;&lt;BR /&gt;rowaxis values=(0 to 100 by 10) label='Percentage of Subjects with Reactions' ;&lt;BR /&gt;keylegend /exclude = ("PERCENT") border;&lt;BR /&gt;run;&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="SG PAnel.PNG" style="width: 686px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67446i4E13C8E6AFC5A8F0/image-size/large?v=v2&amp;amp;px=999" role="button" title="SG PAnel.PNG" alt="SG PAnel.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jan 2022 04:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SAS-SG-Plot-Procedure/m-p/790263#M22497</guid>
      <dc:creator>mounikag</dc:creator>
      <dc:date>2022-01-16T04:36:25Z</dc:date>
    </item>
  </channel>
</rss>

