<?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: How to get rid of negative in front of zero in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516893#M139646</link>
    <description>&lt;P&gt;Use the round() function.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Nov 2018 22:42:40 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-11-28T22:42:40Z</dc:date>
    <item>
      <title>How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516889#M139643</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this line of code that is calculating the mean of a variable. For a couple variables, the mean is a very high negative number (-0.00001) and because I only want one decimal place, SAS ends up printing the mean as -0.0. Is there a way to get rid of this negative sign&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code that I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data statall (keep=trt_dec row1 row2 row3 row4 vid);&lt;BR /&gt;merge sesstat(in=a) median;&lt;BR /&gt;by vid trt_dec;&lt;BR /&gt;if a;&lt;BR /&gt;row1=strip(put(n,8.0));&lt;BR /&gt;if mean ne . then row2=strip(put(mean, 8.1))||' ('||strip(put(std, 8.2))||')';&lt;BR /&gt;if mean =. then row2='-';&lt;BR /&gt;if median ne . then row3=strip(put(round(median, .1), 8.1))||' ('||strip(put(min, 8.0))||', '||strip(put(max, 8.0))||')';&lt;BR /&gt;if median =. then row3='-';&lt;BR /&gt;row4='('||strip(put(uclm, 8.1))||', '||strip(put(lclm, 8.1))||')';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, any help is appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 22:07:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516889#M139643</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2018-11-28T22:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516890#M139644</link>
      <description>&lt;P&gt;Just to be sure, you want the value&amp;nbsp;&lt;SPAN&gt;-0.00001 to be displayed as 0.0, correct?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 22:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516890#M139644</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-11-28T22:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516891#M139645</link>
      <description>&lt;P&gt;Yes, exactly! Just 0.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 22:27:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516891#M139645</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2018-11-28T22:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516893#M139646</link>
      <description>&lt;P&gt;Use the round() function.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 22:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516893#M139646</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-28T22:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516907#M139651</link>
      <description>&lt;P&gt;I tried that, but it then gets rid of my decimal place and I am just left with '0'&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 23:20:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516907#M139651</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2018-11-28T23:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516912#M139654</link>
      <description>&lt;P&gt;So do you just want a format to the number to be decimal X.1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So like...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;format answer 17.1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(17 needs to be big enough to fit your largest integer obviously i just used it as an example)....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So as other users have noticed round your number using round(VAL,.1)&amp;nbsp; and then simply format the new number you came up with?&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 23:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516912#M139654</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2018-11-28T23:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516913#M139655</link>
      <description>&lt;P&gt;In addition to rounding, use a proper display format with one decimal.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/139341"&gt;@kmardinian&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I tried that, but it then gets rid of my decimal place and I am just left with '0'&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 23:41:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/516913#M139655</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-11-28T23:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/517097#M139728</link>
      <description>&lt;P&gt;Can you give me an example of a proper display format?&amp;nbsp; Is that not the 8.1 format I used in my code above after the mean variable?&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 15:45:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/517097#M139728</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2018-11-29T15:45:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/517100#M139729</link>
      <description>&lt;P&gt;Put converts your numeric data into character data.&amp;nbsp; your code SHOULD already be returning a result of 0.0, I am not sure why it isn't so I think something else is going on.&lt;/P&gt;&lt;P&gt;MY suggestion was to keep the data as numeric and simply use an actual FORMAT Answer 8.1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do you get when you run the following code?&amp;nbsp; The second observation should return 0.0, are you seeing only 0?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data ShoWUser;&lt;BR /&gt;infile datalines delimiter=',';&lt;BR /&gt;input Number&lt;BR /&gt;;&lt;BR /&gt;datalines;&lt;BR /&gt;15.514&lt;BR /&gt;-0.00001&lt;BR /&gt;9523.51&lt;BR /&gt;3960.26&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;data yay;&lt;BR /&gt;set ShoWUser;&lt;BR /&gt;answer=strip(put(round(number,.1),8.1));&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 15:53:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/517100#M139729</guid>
      <dc:creator>Anotherdream</dc:creator>
      <dc:date>2018-11-29T15:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/517119#M139733</link>
      <description>&lt;P&gt;Thank you so much, that worked so well!&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 16:24:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/517119#M139733</guid>
      <dc:creator>kmardinian</dc:creator>
      <dc:date>2018-11-29T16:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of negative in front of zero</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/739553#M230844</link>
      <description>&lt;P&gt;Is there a method to display -0.00001 as -0.0? Rounding method is removing the negative sign. Want to see a method which retains the negative sign.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 May 2021 16:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-rid-of-negative-in-front-of-zero/m-p/739553#M230844</guid>
      <dc:creator>ruchitpatel</dc:creator>
      <dc:date>2021-05-06T16:37:40Z</dc:date>
    </item>
  </channel>
</rss>

