<?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: Removing decimals places in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571237#M161138</link>
    <description>Treat as numaric and use round function as shown below, if it is character then use input function&lt;BR /&gt;data have;&lt;BR /&gt;input Field_1 ;&lt;BR /&gt;Field2=round(Field_1, .01);&lt;BR /&gt;datalines;&lt;BR /&gt;22.5&lt;BR /&gt;1.000&lt;BR /&gt;40.000&lt;BR /&gt;1.25&lt;BR /&gt;;&lt;BR /&gt;Run;</description>
    <pubDate>Thu, 04 Jul 2019 12:53:00 GMT</pubDate>
    <dc:creator>bollurajkumar</dc:creator>
    <dc:date>2019-07-04T12:53:00Z</dc:date>
    <item>
      <title>Removing decimals places in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571202#M161121</link>
      <description>&lt;P&gt;Hi I have a table with decimal places, The field is text and I want to remove the decimal places which have no values. See examples below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Current Table&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Field_1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;22.5&lt;/P&gt;&lt;P&gt;1.000&lt;/P&gt;&lt;P&gt;40.000&lt;/P&gt;&lt;P&gt;1.25&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like the table to look as per below, your help in this matter is much appreciated&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Field_1&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;22.5&lt;/P&gt;&lt;P&gt;1&lt;/P&gt;&lt;P&gt;40&lt;/P&gt;&lt;P&gt;1.25&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 10:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571202#M161121</guid>
      <dc:creator>zdassu</dc:creator>
      <dc:date>2019-07-04T10:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Removing decimals places in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571205#M161124</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Field_1 $;
datalines;
22.5
1.000
40.000
1.25
;

data want;
    set have;
    Field_2=put(input(Field_1, best8.), best8. -l);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jul 2019 10:19:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571205#M161124</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-04T10:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: Removing decimals places in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571206#M161125</link>
      <description>use strip(put(input(field_1,8.2),best.))&lt;BR /&gt;</description>
      <pubDate>Thu, 04 Jul 2019 10:20:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571206#M161125</guid>
      <dc:creator>RM6</dc:creator>
      <dc:date>2019-07-04T10:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Removing decimals places in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571210#M161127</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/179384"&gt;@RM6&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;use strip(put(input(field_1,8.2),best.))&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your use of the 8.2 informat is not needed and actually dangerous:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input field1 :$10.;
datalines;
22.5
1.000
40.000
1.25
4000
;

data want;
set have;
field2 = strip(put(input(field1,8.2),best.));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Take a close look at the last observation.&lt;/P&gt;
&lt;P&gt;8. (or simply best.) is sufficient.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 10:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571210#M161127</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-04T10:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Removing decimals places in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571213#M161128</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Field_1 $;
want=prxchange('s/\.0+\s*$//',1,field_1);
cards;
22.5
1.000
40.000
1.25
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jul 2019 11:17:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571213#M161128</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-07-04T11:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Removing decimals places in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571216#M161129</link>
      <description>&lt;P&gt;Treating it as a character operation only:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
field2 = scan(field1,1,'.');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jul 2019 11:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571216#M161129</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-04T11:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Removing decimals places in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571233#M161135</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/59173"&gt;@zdassu&lt;/a&gt;&amp;nbsp;You are trying to mix two formats: 1st and 4th row have decimal places while 2nd and 3rd don't have a decimal. For the entire column/variable you will have to settle down to one choice: with or without decimal. I am not sure if you can choose differently for different rows. So either you decide between 8 and 8.2 (without and with 2 decimals respectively) or let SAS decide with best. option.&lt;/P&gt;&lt;P&gt;Either ways, if I am not wrong, all rows have to conform to one standard/format for that particular column. If I am wrong please correct me.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jul 2019 12:21:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571233#M161135</guid>
      <dc:creator>koyelghosh</dc:creator>
      <dc:date>2019-07-04T12:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: Removing decimals places in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571237#M161138</link>
      <description>Treat as numaric and use round function as shown below, if it is character then use input function&lt;BR /&gt;data have;&lt;BR /&gt;input Field_1 ;&lt;BR /&gt;Field2=round(Field_1, .01);&lt;BR /&gt;datalines;&lt;BR /&gt;22.5&lt;BR /&gt;1.000&lt;BR /&gt;40.000&lt;BR /&gt;1.25&lt;BR /&gt;;&lt;BR /&gt;Run;</description>
      <pubDate>Thu, 04 Jul 2019 12:53:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571237#M161138</guid>
      <dc:creator>bollurajkumar</dc:creator>
      <dc:date>2019-07-04T12:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Removing decimals places in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571301#M161158</link>
      <description>&lt;P&gt;I'll bite...why are you storing numeric data as character text?&amp;nbsp; I suspect that's how your data is &lt;U&gt;now&lt;/U&gt;, or how it is provided to you.&amp;nbsp; But IMO if you stored or converted your text data to numeric, then used formats for display, reporting, etc., life would be easier.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2019 00:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Removing-decimals-places-in-SAS/m-p/571301#M161158</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-07-05T00:11:01Z</dc:date>
    </item>
  </channel>
</rss>

