<?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: converting numeric values to character and not losing the decimals in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304221#M64742</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;estimate = put(estimate,12.3);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Oct 2016 02:27:04 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2016-10-13T02:27:04Z</dc:date>
    <item>
      <title>converting numeric values to character and not losing the decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304217#M64739</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a variable estimate with value = 14.793 and it is in numeric format 12.3 . I would like to convert it to character format and do the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;estimate = put(estimate,$12.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the result that I get is 15.000, and the format is still 12.3. ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 02:19:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304217#M64739</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2016-10-13T02:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: converting numeric values to character and not losing the decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304221#M64742</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;estimate = put(estimate,12.3);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Oct 2016 02:27:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304221#M64742</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2016-10-13T02:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: converting numeric values to character and not losing the decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304223#M64743</link>
      <description>&lt;P&gt;Wow, it works!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Its just that I was expecting the $ sign since I wanted to convert to character, but I guess that is some SAS peculiarity.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank a lot!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 02:33:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304223#M64743</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2016-10-13T02:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: converting numeric values to character and not losing the decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304228#M64746</link>
      <description>&lt;P&gt;$ is for formatting character variables. You format a numeric here.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 02:53:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304228#M64746</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-10-13T02:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: converting numeric values to character and not losing the decimals</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304373#M64794</link>
      <description>&lt;P&gt;PUT creates character variables any time you use x= put (...) or x=Putn(...) or x=putc(...).&lt;/P&gt;
&lt;P&gt;The format involved in the PUT portion controls what the resulting character varaible may look like. The format should match the variable type you are PUTting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS will occasionaly help you by doing implicit conversion if you specify a numeric format for something that is character but looks numeric or specify a numeric variable and a character format though the results may not match what you expect.&lt;/P&gt;
&lt;P&gt;Here is a brief example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data junk;
   x= 25.4;
   y = put(x,$7.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that there is no Error but a warning is placed in the log and that the value of Y may not be as expected and has leading blanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2016 14:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-numeric-values-to-character-and-not-losing-the/m-p/304373#M64794</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-13T14:21:32Z</dc:date>
    </item>
  </channel>
</rss>

