<?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: understanding informat in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15321#M2014</link>
    <description>when your text contains the decimal point never tell a numeric informat how many decimals are present. That feature is needed only where the text has no decimal point.&lt;BR /&gt;
Use informat 8. or percent8.</description>
    <pubDate>Wed, 11 Nov 2009 18:11:20 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2009-11-11T18:11:20Z</dc:date>
    <item>
      <title>understanding informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15316#M2009</link>
      <description>can somebody help me understand how this informat works:&lt;BR /&gt;
&lt;BR /&gt;
data a;&lt;BR /&gt;
input d1 $;&lt;BR /&gt;
cards;&lt;BR /&gt;
700.1 &lt;BR /&gt;
723.45&lt;BR /&gt;
166.3&lt;BR /&gt;
902&lt;BR /&gt;
991&lt;BR /&gt;
217.01&lt;BR /&gt;
98&lt;BR /&gt;
511&lt;BR /&gt;
105.45&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data b;&lt;BR /&gt;
 set a;&lt;BR /&gt;
 format d2 8.2;&lt;BR /&gt;
 d2=input(d1, 8.2);&lt;BR /&gt;
run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I though I would have values in d2 as numeric form of d1 with 2 digit places. but what I got was this:&lt;BR /&gt;
&lt;BR /&gt;
                                                    Obs    d1              d2&lt;BR /&gt;
&lt;BR /&gt;
                                                    1     700.1       700.10&lt;BR /&gt;
                                                    2     723.45      723.45&lt;BR /&gt;
                                                    3     166.3       166.30&lt;BR /&gt;
                                                    4     902           9.02&lt;BR /&gt;
                                                    5     991           9.91&lt;BR /&gt;
                                                    6     217.01      217.01&lt;BR /&gt;
                                                    7     98            0.98&lt;BR /&gt;
                                                    8     511           5.11&lt;BR /&gt;
                                                    9     105.45      105.45&lt;BR /&gt;
&lt;BR /&gt;
if values in d1 represents an integer (no digit) d2 will add 2 digit places. so 98 becomes 0.98 and 511 becomes 5.11.&lt;BR /&gt;
&lt;BR /&gt;
I can work around  this situation by adding a dot to d1, but can somebody help me understand what happened?</description>
      <pubDate>Wed, 11 Nov 2009 17:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15316#M2009</guid>
      <dc:creator>abdullala</dc:creator>
      <dc:date>2009-11-11T17:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: understanding informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15317#M2010</link>
      <description>The SAS numeric variable you assigned is associated with a FORMAT, as you coded, so the PROC PRINT is using that format which is different than what SAS has stored internally.  Either remove the SAS FORMAT statement or use another (more revealing) output format such as BEST. in your code.&lt;BR /&gt;
&lt;BR /&gt;
The SAS DOC has topic discussion about SAS numeric variable precision and storage.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 11 Nov 2009 17:47:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15317#M2010</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-11-11T17:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: understanding informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15318#M2011</link>
      <description>nah -- didn't work. it only works if I change the informat from '8.2' to 'best.'. I want to know why informat 8.2 does not work. this is not about precision, this is about how informat works. thanks!</description>
      <pubDate>Wed, 11 Nov 2009 17:55:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15318#M2011</guid>
      <dc:creator>abdullala</dc:creator>
      <dc:date>2009-11-11T17:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: understanding informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15319#M2012</link>
      <description>The problem seems to be with your input(d1, 8.2) statement.  You are telling SAS to read 2 decimal places.  Use a best. here and SAS will respect your decimal placement.&lt;BR /&gt;
&lt;BR /&gt;
so d2 = input(d1, best.);&lt;BR /&gt;
&lt;BR /&gt;
w.d&lt;BR /&gt;
Syntax Description&lt;BR /&gt;
&lt;BR /&gt;
w &lt;BR /&gt;
specifies the width of the input field.&lt;BR /&gt;
&lt;BR /&gt;
Range: 1-32 &lt;BR /&gt;
&lt;BR /&gt;
d &lt;BR /&gt;
optionally specifies the power of 10 by which to divide the value. If the data contain decimal points, the d value is ignored.&lt;BR /&gt;
&lt;BR /&gt;
Range: 0-31</description>
      <pubDate>Wed, 11 Nov 2009 17:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15319#M2012</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2009-11-11T17:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: understanding informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15320#M2013</link>
      <description>thank you very much Flip! that's what I have been missing.</description>
      <pubDate>Wed, 11 Nov 2009 18:08:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15320#M2013</guid>
      <dc:creator>abdullala</dc:creator>
      <dc:date>2009-11-11T18:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: understanding informat</title>
      <link>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15321#M2014</link>
      <description>when your text contains the decimal point never tell a numeric informat how many decimals are present. That feature is needed only where the text has no decimal point.&lt;BR /&gt;
Use informat 8. or percent8.</description>
      <pubDate>Wed, 11 Nov 2009 18:11:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/understanding-informat/m-p/15321#M2014</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-11-11T18:11:20Z</dc:date>
    </item>
  </channel>
</rss>

