<?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: AXISTABLE statement in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578109#M18592</link>
    <description>&lt;P&gt;Great job, Jeff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also wondered why the OP is constructing these plots by hand. There is &lt;A href="https://go.documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_kaplan_toc.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;a chapter in the SAS/STAT doc dedicated to creating these plots&lt;/A&gt;.&amp;nbsp; If the issue is wanting to arrange them side-by-side, then look into&lt;A href="https://blogs.sas.com/content/sasdummy/2015/11/23/ods-statement-options-to-change/" target="_self"&gt; the ODS LAYOUT statement&lt;/A&gt;, which enables you to arrange multiple graphs or tables into a grid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, problems solved (I hope)&lt;/P&gt;</description>
    <pubDate>Wed, 31 Jul 2019 15:05:22 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2019-07-31T15:05:22Z</dc:date>
    <item>
      <title>AXISTABLE statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/577880#M18584</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm reproducing a Kaplan-Meier stepplot in layout lattice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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-center" image-alt="Unknown.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31427iD16FF28984B2F98A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Unknown.png" alt="Unknown.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering why in the right graph, the axis table with patients at risk is located a bit higher than the corresponding table on the left.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attach the code I used, if of any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
	define statgraph Fig_2_KM;
		begingraph / collation=binary designheight=480 designwidth=1280;
		layout lattice / rows=1 columns=2 rowgutter=10 columngutter=10 ;

		/*Unmatched population*/
		legenditem type=text name="log" / label="Logrank p=0.0007" 
			lineattrs=(color=black);
		layout overlay / xaxisopts=(Label="Years of Follow-up" 
			LabelAttrs=(Weight=normal) type=linear) y2axisopts=(labelFitPolicy=Split) 
			yaxisopts=(Label=" " labelFitPolicy=Split 
			LabelAttrs=(Weight=normal) type=linear linearopts=(viewmin=0) ) 
			y2axisopts=(labelFitPolicy=Split);
		entry "in the Unmatched Population" / valign=top location=outside 
			textattrs=(weight=bold);
		entry "Product-Limit Survival Estimates"/ valign=top location=outside 
			textattrs=(weight=bold size=12);
		StepPlot X=Time Y=Survival / primary=true Group=Stratum Lineattrs=(Pattern=1 
			Thickness=1) LegendLabel="Survival Probability" NAME="STEP";
		scatterplot x=time y=censored / markerattrs=(symbol=plus) name='c';
		scatterplot x=time y=censored / markerattrs=(symbol=plus) GROUP=stratum;
		discretelegend 'c' 'log' / location=inside halign=right valign=top 
			order=columnmajor valueattrs=(size=10) border=false;
		drawtext textattrs=(size=10) 'Survival Probability' / x=-8 y=60 anchor=bottom 
                   xspace=wallpercent yspace=wallpercent rotate=90 width=50;	

		/*--Subjects at risk-Unmatched--*/
		InnerMargin / align=bottom opaque=true;
		AxisTable Value=AtRisk X=tAtRisk / labelPosition=min Class=Stratum
			LabelAttrs=(Weight=normal) ValueAttrs=(Size=10) colorGroup=Stratum
			Display=(Label Values) title="Subjects at risk" titleattrs=(size=10);
		EndInnerMargin;
		DiscreteLegend "STEP";
		endlayout;

		/*Matched population*/
		legenditem type=text name="log2" / label="Logrank p=0.9417" 
			lineattrs=(color=black);
		layout overlay / xaxisopts=(Label="Years of Follow-up" 
			LabelAttrs=(Weight=normal) type=linear) y2axisopts=(labelFitPolicy=Split) 
			yaxisopts=(Label=" " labelFitPolicy=Split 
			LabelAttrs=(Weight=normal) type=linear linearopts=(viewmin=0) ) 
			y2axisopts=(labelFitPolicy=Split);
		entry "in the Matched Population" / valign=top location=outside 
			textattrs=(weight=bold);
		entry "Product-Limit Survival Estimates"/ valign=top location=outside 
			textattrs=(weight=bold size=12);
		StepPlot X=Time2 Y=Survival2 / primary=true group=Stratum2
			Lineattrs=(Pattern=1 Thickness=1) LegendLabel="Survival Probability" 
			NAME="STEP2";
		scatterplot x=time2 y=censored2 / markerattrs=(symbol=plus) name='c2' 
			legendlabel="Censored";
		scatterplot x=time2 y=censored2 / markerattrs=(symbol=plus) GROUP=stratum2;
		discretelegend 'c2' 'log2' / location=inside halign=right valign=top  
			order=columnmajor valueattrs=(size=10) border=false;
		drawtext textattrs=(size=10) 'Survival Probability' / x=-8 y=60 anchor=bottom 
                   xspace=wallpercent yspace=wallpercent rotate=90 width=50;	
		/*--Subjects at risk-Unmatched--*/
		InnerMargin / align=bottom opaque=true;
		AxisTable Value=AtRisk2 X=tAtRisk2 / labelPosition=min  class=Stratum2
			LabelAttrs=(Weight=normal) ValueAttrs=(Size=10) colorGroup=Stratum2
			Display=(Label Values) title="Subjects at risk" titleattrs=(size=10);
		EndInnerMargin;
		DiscreteLegend "STEP";
		endlayout;
		endlayout;
		endgraph;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sincerely&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2019 19:37:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/577880#M18584</guid>
      <dc:creator>antor82</dc:creator>
      <dc:date>2019-07-30T19:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: AXISTABLE statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578023#M18585</link>
      <description>&lt;P&gt;Can you provide the data?&lt;/P&gt;
&lt;P&gt;Without the data, I can't test my idea, but it's possible that the data ranges are slightly different. Try adding&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;columndatarange=union rowdatarange=union&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;to the LAYOUT LATTICE options.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 12:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578023#M18585</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-07-31T12:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: AXISTABLE statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578032#M18586</link>
      <description>Sorry…. It doesn’t work….&lt;BR /&gt;&lt;BR /&gt;However, if I exclude the class=Stratum2 from the code, I obviously obtain one single line with patients at risk BUT on the same level as the red one on the graph of the left.&lt;BR /&gt;</description>
      <pubDate>Wed, 31 Jul 2019 12:34:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578032#M18586</guid>
      <dc:creator>antor82</dc:creator>
      <dc:date>2019-07-31T12:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: AXISTABLE statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578046#M18587</link>
      <description>&lt;P&gt;Without the data, this could take all day. Try this...try that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The question in my mind is whether it is a data issue (the data are responsible for the difference) or whether it is a template issue (like a font difference that we aren't noticing).&amp;nbsp; To determine whether the data are responsible, try this:&lt;/P&gt;
&lt;P&gt;1. Temporarily modify the template so that the second plot uses Time, Survival, and Censored variables instead of&amp;nbsp;&amp;nbsp;Time2, Survival2, and Censored2. Any change?&lt;/P&gt;
&lt;P&gt;2. If the problem still persists, put back&amp;nbsp;Time2, Survival2, and Censored2, but now temporarily modify the template to use&amp;nbsp;AtRisk, tAtRisk, and Stratum in the second AXISTABLE statement? Any change?&lt;/P&gt;
&lt;P&gt;3. You can combine 1 and 2 so that you have identical plots on the left and the right. Hopefully, they will be identical in this case.&lt;/P&gt;
&lt;P&gt;4. Notice that the first axistable has a three-digit number (147) whereas the second axistable does not. Play around with various alignment, justification, and formatting options to see whether that is the issue. (#2 should reveal whether it is an issue.) I'm not very familiar with AXISTABLE options, but I'd start with VALUEFORMAT=3. or try to right-align the numbers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 13:00:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578046#M18587</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-07-31T13:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: AXISTABLE statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578066#M18589</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; I've attached the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I change Stratum2 with StratumNum2 --&amp;gt; I can see three different rows, namely&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;therefore I think that there is some missing value in Stratum2 and StratumNum2 that creates this problems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suggestion #1: nothing happens;&lt;/P&gt;&lt;P&gt;Suggestion #2: number of its at risk is correctly placed!&lt;/P&gt;&lt;P&gt;Suggestion #3: two identical plots.&lt;/P&gt;&lt;P&gt;Suggestion #4: I don't thin it is a problem of digits.&lt;/P&gt;&lt;P&gt;Because the problem manifests when I use the Stratum2 or StratumNum2 (which can be used alternatively, it's only a metter of how the two strata appear on the graph).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 13:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578066#M18589</guid>
      <dc:creator>antor82</dc:creator>
      <dc:date>2019-07-31T13:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: AXISTABLE statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578090#M18590</link>
      <description>&lt;P&gt;I don't know why the axis tables are not aligned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, if you are interested in solving the problem another way, I suggest that you&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Restructure the data from wide to long. That will get rid of the missing values in STRATUM2.&lt;/P&gt;
&lt;P&gt;2. &lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2016/12/15/ods-graphics-designer/" target="_self"&gt;Use ODS Graphics Designer&lt;/A&gt; to mock up a template that creates the main features, then customize it by hand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This will allow you to use the DATALATTICE layout, which is preferred if you are creating a panel like this with equated axes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a start, if you want to pursue it:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* convert from wide to long */
data s1;
set lib.survival_unified;
keep Time Survival AtRisk Event Censored tAtRisk Stratum StratumNum;
run;
data s2;
set lib.survival_unified;
keep Time2 Survival2 AtRisk2 Event2 Censored2 tAtRisk2 Stratum2 StratumNum2;
rename Time2=Time
       Survival2=Survival
       AtRisk2=AtRisk
       Event2=Event
       Censored2=Censored
       tAtRisk2=tAtRisk
       Stratum2=Stratum
       StratumNum2=StratumNum;
run;

data survival;
set s1(in=in1) s2;
if in1 then Group=1;
else Group=2;
run;


/* some sample code from ODS designer to get you started */
proc template;
define statgraph sgdesign;
dynamic _TIME _CENSORED _STRATUM _GROUP _TIME2 _SURVIVAL _STRATUM2 _TATRISK _ATRISK _STRATUM3 _GROUP2;
dynamic _panelnumber_;
begingraph / designwidth=1162 designheight=480;
   entrytitle halign=center 'Type in your title...';
   entryfootnote halign=left 'Type in your footnote...';
   layout datalattice columnvar=_GROUP / cellwidthmin=1 cellheightmin=1 rowgutter=3 columngutter=3 rowdatarange=unionall row2datarange=unionall columndatarange=unionall column2datarange=unionall headerlabeldisplay=value rowaxisopts=( offsetmin=0.2 linearopts=( viewmin=0.0));
      layout prototype / ;
         scatterplot x=_TIME y=_CENSORED / group=_STRATUM name='scatter';
         stepplot x=_TIME2 y=_SURVIVAL / group=_STRATUM2 name='step' connectorder=xaxis grouporder=data clusterwidth=0.85;
         axistable x=_TATRISK value=_ATRISK / class=_STRATUM3 colorgroup=_GROUP2 stat=mean name='axistable_h2' labelposition=min;
      endlayout;
   endlayout;
endgraph;
end;
run;

proc sgrender data=WORK.SURVIVAL template=sgdesign;
dynamic _TIME="TIME" _CENSORED="CENSORED" _STRATUM="STRATUM" _GROUP="GROUP" _TIME2="TIME" _SURVIVAL="SURVIVAL" _STRATUM2="STRATUM" _TATRISK="TATRISK" _ATRISK="ATRISK" _STRATUM3="STRATUM" _GROUP2="GROUP";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 Jul 2019 14:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578090#M18590</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-07-31T14:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: AXISTABLE statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578105#M18591</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; I was able to fix this by adding the INCLUDEMISSINGCLASS=FALSE option to the AXISTABLE statement.&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="SGRender.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31445iA74945B3AAD7210C/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGRender.png" alt="SGRender.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also putting out a plug for my macro NEWSURV that can make these kind of lattice of survival plots for you:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Kaplan-Meier-Survival-Plotting-Macro-NEWSURV/tac-p/568304" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Kaplan-Meier-Survival-Plotting-Macro-NEWSURV/tac-p/568304&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 14:51:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578105#M18591</guid>
      <dc:creator>JeffMeyers</dc:creator>
      <dc:date>2019-07-31T14:51:35Z</dc:date>
    </item>
    <item>
      <title>Re: AXISTABLE statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578109#M18592</link>
      <description>&lt;P&gt;Great job, Jeff.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also wondered why the OP is constructing these plots by hand. There is &lt;A href="https://go.documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_kaplan_toc.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;a chapter in the SAS/STAT doc dedicated to creating these plots&lt;/A&gt;.&amp;nbsp; If the issue is wanting to arrange them side-by-side, then look into&lt;A href="https://blogs.sas.com/content/sasdummy/2015/11/23/ods-statement-options-to-change/" target="_self"&gt; the ODS LAYOUT statement&lt;/A&gt;, which enables you to arrange multiple graphs or tables into a grid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, problems solved (I hope)&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 15:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578109#M18592</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-07-31T15:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: AXISTABLE statement</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578110#M18593</link>
      <description>Thank You very much!!!!</description>
      <pubDate>Wed, 31 Jul 2019 15:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/AXISTABLE-statement/m-p/578110#M18593</guid>
      <dc:creator>antor82</dc:creator>
      <dc:date>2019-07-31T15:14:03Z</dc:date>
    </item>
  </channel>
</rss>

