<?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: X axis range doesn't match to the range of underlying dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569912#M160658</link>
    <description>&lt;P&gt;Density plots are based on an estimated distribution as requested and as such the distribution indicated by your data will often have values outside the range of your data. The display will tend to cut off at a point where no more useful information is displayed, i.e. all of the Y values are so close to 0 that you can't tell the difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A normal distribution always has a domain (x values) of plus or minus infinity. But typically when you get to X plus/minus 4 standard deviations there isn't much detectible difference in the Y values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really&amp;nbsp;don't want to see the curve past your limits provide a VALUES clause to the XAXIS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2019 17:48:11 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-06-28T17:48:11Z</dc:date>
    <item>
      <title>X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569908#M160657</link>
      <description>&lt;P&gt;Hi Folks:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to compare the distribution of survival time across A, B, C and D groupS of populations. However, x-axis range of my kernel density plot doesn't match (it even took negative value) to the range of underlying data. Proc means returns min=0 and max 4015. Am I missing to specify any options in the proc sgplot to match x-axis to the underlying data? How to tie my x-axis to the data?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="surv_days.png" style="width: 248px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30633iF06F226AF2AF2C95/image-size/large?v=v2&amp;amp;px=999" role="button" title="surv_days.png" alt="surv_days.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any hints appreciated.&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kernel density.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30634i6D066B42CC682A3C/image-size/large?v=v2&amp;amp;px=999" role="button" title="kernel density.png" alt="kernel density.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data = MYDATA;
title "SURVIVAL TIME DISTRIBUTION";
yaxis label = "Percent" offsetmax=0 values=(0 to 8 by 0.5);
xaxis label = "What is X axis?" grid;
styleattrs DATACONTRASTCOLORS=(BLUE green PURPLE red);
density DUR_GOLD / scale=percent type = kernel legendlabel = "A" ;
density DUR_RAND / scale=percent type = kernel legendlabel = "B" ;
density DUR_MID / scale=percent type = kernel legendlabel = "C" ;
density SURV_DAYS / scale=percent type = kernel legendlabel = "D" ;
keylegend / location=OUTSIDE position=top;
run;

proc means data=MYDATA maxdec=1 max min;
var A B C D;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 17:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569908#M160657</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-28T17:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569912#M160658</link>
      <description>&lt;P&gt;Density plots are based on an estimated distribution as requested and as such the distribution indicated by your data will often have values outside the range of your data. The display will tend to cut off at a point where no more useful information is displayed, i.e. all of the Y values are so close to 0 that you can't tell the difference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A normal distribution always has a domain (x values) of plus or minus infinity. But typically when you get to X plus/minus 4 standard deviations there isn't much detectible difference in the Y values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really&amp;nbsp;don't want to see the curve past your limits provide a VALUES clause to the XAXIS statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 17:48:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569912#M160658</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-28T17:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569917#M160661</link>
      <description>Question, why does the proc sgplot refer to different variables than proc means even though the same input data set? In that situation, I wouldn't expect them to match.</description>
      <pubDate>Fri, 28 Jun 2019 17:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569917#M160661</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-28T17:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569919#M160662</link>
      <description>&lt;P&gt;tHANKS &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Specifying limits results in following plot.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data = mydata; /*N=12,061*/
    title "SURVIVAL TIME DISTRIBUTION";
    yaxis label = "Percent" offsetmax=0 values=(0 to 8 by 0.5); 
	xaxis label = "Survival Time in Days" grid offsetmax=0 values=(0 to 4500 by 100); 
	styleattrs DATACONTRASTCOLORS=(BLUE green PURPLE red);
    density DUR_GOLD / scale=percent type = kernel legendlabel = "A" ; 
	density DUR_RAND / scale=percent type = kernel legendlabel = "B" ; 
	density DUR_MID / scale=percent type = kernel legendlabel = "C" ; 
	density SURV_DAYS / scale=percent type = kernel legendlabel = "D" ; 
	keylegend / location=OUTSIDE position=top;
run;  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KERNEL DENS CHANGED.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30635iDC5B9C117B0F233E/image-size/large?v=v2&amp;amp;px=999" role="button" title="KERNEL DENS CHANGED.png" alt="KERNEL DENS CHANGED.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 17:56:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569919#M160662</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-28T17:56:55Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569920#M160663</link>
      <description>I was gonna conceal actual names of variables and use A, B,C,D instead. I have to change that in the post here</description>
      <pubDate>Fri, 28 Jun 2019 17:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569920#M160663</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-28T17:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569922#M160664</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="real mean.png" style="width: 243px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/30636i4EB578FF2FF9802A/image-size/large?v=v2&amp;amp;px=999" role="button" title="real mean.png" alt="real mean.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc means on actual variables&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 18:00:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569922#M160664</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-28T18:00:28Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569949#M160672</link>
      <description>My guess is that Density statement doesn't do what you think it does, ie it assumes your data has a normal distribution and fits a distribution to it, it doesn't plot the a cdf or pdf type plot.</description>
      <pubDate>Fri, 28 Jun 2019 19:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569949#M160672</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-28T19:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569956#M160674</link>
      <description>I agree. x-axis still takes negative values even if i switch kernel to normal.</description>
      <pubDate>Fri, 28 Jun 2019 19:23:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569956#M160674</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-28T19:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569957#M160675</link>
      <description>Which makes sense to me. I think you want a histogram instead really, just a smaller granularity perhaps?</description>
      <pubDate>Fri, 28 Jun 2019 19:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569957#M160675</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-28T19:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569974#M160681</link>
      <description>Yes, histogram, I think, will require long format data vs mine right now is organized wide where A,B,C AND D are separate variables. It takes me a while to reconfigure data for a Histogram using group option. Please let me know if there's a way to do it using wide format for histogram.</description>
      <pubDate>Fri, 28 Jun 2019 20:17:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569974#M160681</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-06-28T20:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: X axis range doesn't match to the range of underlying dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569979#M160685</link>
      <description>Multiple histogram statements? 4 of them isn't too bad and probably just as much code as a PROC TRANSPOSE.</description>
      <pubDate>Fri, 28 Jun 2019 20:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/X-axis-range-doesn-t-match-to-the-range-of-underlying-dataset/m-p/569979#M160685</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-06-28T20:29:24Z</dc:date>
    </item>
  </channel>
</rss>

