<?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: URGENT: problem regarding  decimal places being automatically changed by sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560336#M156663</link>
    <description>&lt;P&gt;From the documentation of the w.d informat:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Syntax
w.d
Syntax Description
w
specifies the width of the input field. 

Range 1-32 

d
specifies the power of 10 by which to divide the value. If the data contain decimal points, the d value is ignored. This argument is optional. 

Range 0-31 

&lt;/PRE&gt;
&lt;P&gt;So, for numbers strings NOT containing a decimal point, such as "2906", the 16.2 informat will cause the number to be divided by 100, hence the 20.06 result. Solution: use informat 16. or Best16. (synonym) instead.&lt;/P&gt;</description>
    <pubDate>Tue, 21 May 2019 03:44:14 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2019-05-21T03:44:14Z</dc:date>
    <item>
      <title>URGENT: problem regarding  decimal places being automatically changed by sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560328#M156657</link>
      <description>&lt;P&gt;Hi, was facing some problem regarding the decimal places.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my excel csv format file my datas were in this format,for eg:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;zclmpd&lt;/P&gt;&lt;P&gt;0&lt;/P&gt;&lt;P&gt;2906&lt;/P&gt;&lt;P&gt;0&lt;/P&gt;&lt;P&gt;6092.63&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however, when I infile my excel cxv file into SAS, sas read it like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;zclmpd&lt;/P&gt;&lt;P&gt;0.00&lt;/P&gt;&lt;P&gt;29.06&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;- this is wrong&lt;/P&gt;&lt;P&gt;0&lt;/P&gt;&lt;P&gt;6092.63&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how can I solve this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there any wrong with my code below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data 201812;&lt;/P&gt;&lt;P&gt;%let _EFIERR_=0;&lt;/P&gt;&lt;P&gt;infile 'D:File\201812.csv' dlm=',' MISSOVER DSD lrecl=32767 firstobs=2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;informat zclmpd 16.2;&lt;/P&gt;&lt;P&gt;informat zosqs 16.2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;format zclmpd 16.2;&lt;/P&gt;&lt;P&gt;format zosqs 16.2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;INPUT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;zclmpd&lt;/P&gt;&lt;P&gt;zosqs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;　&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if _ERROR_ then call symputx('_EFIERR_',1);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 07:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560328#M156657</guid>
      <dc:creator>Kayla_Tan222</dc:creator>
      <dc:date>2019-05-22T07:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT: problem regarding  decimal places being automatically changed by sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560330#M156659</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
   input number 16.2;
   datalines;
0
2906
0
6092.63
;
run;

data test2;
   input number best32.;
   datalines;
0
2906
0
6092.63
;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 May 2019 03:23:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560330#M156659</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2019-05-21T03:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT: problem regarding  decimal places being automatically changed by sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560332#M156660</link>
      <description>&lt;P&gt;Thank you ScottBass!&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 03:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560332#M156660</guid>
      <dc:creator>Kayla_Tan222</dc:creator>
      <dc:date>2019-05-21T03:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT: problem regarding  decimal places being automatically changed by sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560336#M156663</link>
      <description>&lt;P&gt;From the documentation of the w.d informat:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Syntax
w.d
Syntax Description
w
specifies the width of the input field. 

Range 1-32 

d
specifies the power of 10 by which to divide the value. If the data contain decimal points, the d value is ignored. This argument is optional. 

Range 0-31 

&lt;/PRE&gt;
&lt;P&gt;So, for numbers strings NOT containing a decimal point, such as "2906", the 16.2 informat will cause the number to be divided by 100, hence the 20.06 result. Solution: use informat 16. or Best16. (synonym) instead.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 03:44:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560336#M156663</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-05-21T03:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT: problem regarding  decimal places being automatically changed by sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560343#M156665</link>
      <description>&lt;P&gt;Hi PG states,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried to run my code with best16.2&lt;/P&gt;&lt;P&gt;the result with best16.2 able to get the result that I want which is 2906 compare to informat16.2 which get 29.06&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought there is no difference between informat16.2 and best16.2, but it is not.&lt;/P&gt;&lt;P&gt;I have tried google search the meaning but I do not understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can you help me with this?&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 04:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560343#M156665</guid>
      <dc:creator>Kayla_Tan222</dc:creator>
      <dc:date>2019-05-21T04:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT: problem regarding  decimal places being automatically changed by sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560344#M156666</link>
      <description>&lt;P&gt;Use 16.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;not 16.2&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the 2 tells SAS to divide by 100.&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 04:19:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560344#M156666</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-05-21T04:19:28Z</dc:date>
    </item>
    <item>
      <title>Re: URGENT: problem regarding  decimal places being automatically changed by sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560550#M156777</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/274500"&gt;@Kayla_Tan222&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi PG states,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried to run my code with best16.2&lt;/P&gt;
&lt;P&gt;the result with best16.2 able to get the result that I want which is 2906 compare to informat16.2 which get 29.06&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought there is no difference between informat16.2 and best16.2, but it is not.&lt;/P&gt;
&lt;P&gt;I have tried google search the meaning but I do not understand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can you help me with this?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Some history about why this behavior exists.&lt;/P&gt;
&lt;P&gt;Many years ago most data was entered for computer use using a physical card created with a keypunch machine. This card had space for a maximum of 80 characters. Since many of the numbers used for entry, and especially US finance, used a common fixed number of decimals in currency values the fields, get more data on a single card, used an implied decimal position. Suppose the first 16 characters were supposed to be a currency value and the 15th and 16th positions represented a fraction of a dollar. Then the card would be punched something like:&lt;/P&gt;
&lt;PRE&gt;      123456789
             ^ implied decimal before the 8&lt;/PRE&gt;
&lt;P&gt;So when &lt;STRONG&gt;you&lt;/STRONG&gt; specify a decimal in reading as 16.2 then you are telling SAS to use the rules for an implied decimal, just like 40 years ago because the program has been told by &lt;STRONG&gt;you&lt;/STRONG&gt; that you know the behavior of the data needs that decimal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some data systems still do that because of the design and they work.&lt;/P&gt;
&lt;P&gt;I have some incoming data files that have bits like:&lt;/P&gt;
&lt;PRE&gt;050519832222210000012032200211221222999999991211201065499992132162999919209999-121439990409201013699912212010030120089910409201099000001022100001566179&lt;/PRE&gt;
&lt;P&gt;Which&amp;nbsp;is about&amp;nbsp;50 variables, some of which have implied decimals. So it is nice that I can read the data directly and get the decimals where they need to be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if I specify 16.2 I am telling SAS "that variable needs two decimals. If there is not one in the actual text read, supply it".&lt;/P&gt;
&lt;P&gt;If I specify an informat of 16. I am telling SAS "read up to 16 digits and use any decimals when present otherwise the value is an integer"&lt;/P&gt;
&lt;PRE&gt;data junk;
   input x :16.  y :16.2;
datalines;
123       123
123.456   123.456
123E4     123E4
;
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 May 2019 15:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/URGENT-problem-regarding-decimal-places-being-automatically/m-p/560550#M156777</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-21T15:20:16Z</dc:date>
    </item>
  </channel>
</rss>

