<?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: Apply a format to x-axis of a histogram using proc univariate in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208240#M7788</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you attach a sample data set that will work with your program?&amp;nbsp; Then we can try ways ways to improve the graph?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you care if the X axis has a simple linear tick values?&amp;nbsp; That usually works well in such cases, unless you absolutely need these long bin edge values on the x axis.&amp;nbsp; You can get that by using the Histogram statement in proc SGPLOT instead of proc UNIVARIATE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Mar 2015 16:33:57 GMT</pubDate>
    <dc:creator>Jay54</dc:creator>
    <dc:date>2015-03-24T16:33:57Z</dc:date>
    <item>
      <title>Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208234#M7782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi ,&lt;/P&gt;&lt;P&gt;I created a histogram on a numeric variable which has 10 digts after the decimal point. I want that to be retained as I like the distribution of the values by the bars, but the numbers displayed on the x-axis should have only 2 digits after the decimal point. Is it possible to manipulate the format of the x -axis in proc univariate only ? My code is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc univariate data=test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var var1;&lt;/P&gt;&lt;P&gt; histograms /midpoints= 5.6703546745 to 35.9034765215 by 0.5;&amp;nbsp; &lt;SPAN style="color: #008000;"&gt;/* assume the minimum value of var1 is 5.6703546745 and maximum value of var1 is 35.9034765215 */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 20:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208234#M7782</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2015-03-23T20:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208235#M7783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would try adding a statement: Format var1 f5.2;&lt;/P&gt;&lt;P&gt;By default my midpoints default to 2 decimals with data in a similar range.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 21:17:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208235#M7783</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-23T21:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208236#M7784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@ballardw...I don't want to change the format of var1 , because once you round up all the values they are very similar and I don't&amp;nbsp; get get a detailed graph. I just want to change the display of the major unit on the x-axis and round those values to the 2nd decimal point. I was looking through all options in proc univariate and I didn't come across any for the x- or horizontal axis as yet. Do you have any suggestions for me ? or is it just not possible with proc univariate ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 12:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208236#M7784</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2015-03-24T12:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208237#M7785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is hard to see what is going on and make suggestions if you do not provide the full program with data.&amp;nbsp; Also provide the SAS release you are using.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 13:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208237#M7785</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2015-03-24T13:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208238#M7786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Sanjay@SAS..I understand.&amp;nbsp; I am working on it and will post it soon.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 13:51:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208238#M7786</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2015-03-24T13:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208239#M7787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@ballardw and @Sanjay@SAS.....&lt;/P&gt;&lt;P&gt;I am using SAS 9.4. My present graph's x-axis looks like this. This is just an example. My original graph shows a nice bell shaped distribution as it has a lot of observations and the right intervals on the x-axis. Now ,I am only interested in displaying 2 digits after the decimal point on major unit on the horizontal axis . The reason being I have 1000 such observations and it gets too crowded on the x-axis. I do not wish to change the format of the var1 variable and round it to the 2nd decimal , because I then loose the details in the distribution of the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code is generic as the input data set changes but the variable name is the same.&lt;/P&gt;&lt;P&gt;proc univariate data=a.&amp;amp;dataset. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var var1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; histogram/ midpoints=&amp;amp;var1_min to &amp;amp;var1_max by 0.5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rtinclude;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jiveImage" src="https://communities.sas.com/legacyfs/online/9733_pastedImage_0.png" style="width: 483px; height: 291px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 16:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208239#M7787</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2015-03-24T16:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208240#M7788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you attach a sample data set that will work with your program?&amp;nbsp; Then we can try ways ways to improve the graph?&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you care if the X axis has a simple linear tick values?&amp;nbsp; That usually works well in such cases, unless you absolutely need these long bin edge values on the x axis.&amp;nbsp; You can get that by using the Histogram statement in proc SGPLOT instead of proc UNIVARIATE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 16:33:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208240#M7788</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2015-03-24T16:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208241#M7789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If I understand that&lt;/P&gt;&lt;P&gt;Format var1 f4.2; doesn't work then you have much more work in defining boundaries and then using a different procedure to plot the data using a different procedure.&lt;/P&gt;&lt;P&gt;You might be able to create a custom format from you macro variables such that you set the range and have the value displayed to the precision you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 16:34:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208241#M7789</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-03-24T16:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208242#M7790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to figure the same @ballardw but would like a simpler solution. @Sanjay@SAS and ballardw here is a better example of my graph and closely represents my original graph. Now since there are 100 observations on the x-axis...major unit values are represented upto 4 digits after the decimal point. Would doing this graph in sgplot give me better control on the x-axis major unit format? @Sanjay@SAS , this is the range of values in var1. Hope this helps. Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jiveImage" src="https://communities.sas.com/legacyfs/online/9735_pastedImage_1.png" style="width: 628px; height: 424px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 17:00:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208242#M7790</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2015-03-24T17:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208243#M7791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As &lt;A __default_attr="239177" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; said, I would try using PROC SGPLOT. Use the BINSTART and BINWIDTH options on the HISTOGRAM statement to set up the midpoints as you did with UNIVARIATE. By default, the x-axis will display using a linear style axis. There is a BINAXIS option; but I agree with Sanjay that the linear axis will probably look a lot better.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 17:09:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208243#M7791</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2015-03-24T17:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208244#M7792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All right I will try proc sgplot, but before I do that...what do you mean by linear style axis ? Does it mean the major unit values will rounded up to a whole number ? I do need it by the 2nd decimal point though. If I remember, I shall be able to achieve that using sgplot.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 18:01:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208244#M7792</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2015-03-24T18:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208245#M7793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the VALUES option on the XAXIS statement to specify the first, last and increment of the tick values you want. Also, specify the VALUESHINT so that the data range of the axis is not affected. Neither of these settings should affect the histogram midpoints.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 18:10:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208245#M7793</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2015-03-24T18:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208246#M7794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;By default, the axis tick values are placed at "rounded" values in the correct scaled location and marked as such.&amp;nbsp; So, for your case, the x axis tick values will likely be 4, 6, 8, 10 and so on, placed at the right location on the x axis.&amp;nbsp; You will only see the number of decimals that are needed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The tick values will NOT necessarily line up with the bins.&amp;nbsp; See example below.&amp;nbsp; The first is UNIVARIATE, each bin has a value at its center.&amp;nbsp; The second is SGPLOT, where the x axis has rounded values evenly placed at the right location, but not necessarily at the center of each bin. The second can be useful with a large number of bins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can specify other tick values as you need as suggested by Dan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="9742" alt="Hist_Univariate.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/9742_Hist_Univariate.png" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="9743" alt="Hist_SGPlot.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/9743_Hist_SGPlot.png" width="450" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 18:22:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208246#M7794</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2015-03-24T18:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Apply a format to x-axis of a histogram using proc univariate</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208247#M7795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Sanjay@SAS and DanH for your advice. I will get working on it now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Mar 2015 18:55:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Apply-a-format-to-x-axis-of-a-histogram-using-proc-univariate/m-p/208247#M7795</guid>
      <dc:creator>dr2014</dc:creator>
      <dc:date>2015-03-24T18:55:24Z</dc:date>
    </item>
  </channel>
</rss>

