<?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: Decimal specification in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212216#M52419</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Format specification is w.d&lt;/P&gt;&lt;P&gt;&lt;SPAN class="strong" style="font-weight: bold;"&gt;&lt;SPAN class="strongEmph" style="font-style: italic;"&gt;w&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a000841385" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the width of the output field.&lt;/P&gt;&lt;TABLE cellpadding="4" cellspacing="2"&gt;&lt;TBODY style="font-family: inherit;"&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Range:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a000841386" style="font-family: inherit;"&gt;&lt;/A&gt;1-32&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Tip:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a000841387" style="font-family: inherit;"&gt;&lt;/A&gt;Allow enough space to write the value, the decimal point, and a minus sign, if necessary.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN class="strong" style="font-weight: bold;"&gt;&lt;A name="a000841388" style="font-weight: normal; font-family: inherit;"&gt;&lt;/A&gt;&lt;SPAN class="strongEmph" style="font-style: italic;"&gt;d&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a000841389" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the number of digits to the right of the decimal point in the numeric value. This argument is optional.&lt;/P&gt;&lt;TABLE cellpadding="4" cellspacing="2"&gt;&lt;TBODY style="font-family: inherit;"&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Range:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a000841390" style="font-family: inherit;"&gt;&lt;/A&gt;0-31&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Requirement:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a002892221" style="font-family: inherit;"&gt;&lt;/A&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;must be less than &lt;SPAN class="strongEmph" style="font-style: italic;"&gt;w&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Tip:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a000841391" style="font-family: inherit;"&gt;&lt;/A&gt;If &lt;SPAN class="strongEmph" style="font-weight: bold; font-style: italic;"&gt;d&lt;/SPAN&gt; is 0 or you omit &lt;SPAN class="strongEmph" style="font-weight: bold; font-style: italic;"&gt;d&lt;/SPAN&gt;, &lt;SPAN class="strongEmph" style="font-weight: bold; font-style: italic;"&gt;w&lt;/SPAN&gt;.&lt;SPAN class="strongEmph" style="font-weight: bold; font-style: italic;"&gt;d&lt;/SPAN&gt; writes the value without a decimal point.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-size: 13.4399995803833px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199377.htm" title="https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199377.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;W = 8.2&lt;/P&gt;&lt;P&gt;WWWWW.DD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I don't think you can have 19 decimal places, IEEE floating point number rules.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 Jul 2015 15:36:37 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-07-28T15:36:37Z</dc:date>
    <item>
      <title>Decimal specification</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212214#M52417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm trying to import data from .txt file. 2 columns are of length 9.19 and 5.8 in the source file; &lt;/P&gt;&lt;P&gt;But in SAS when I write a FORMAT with 9.19 and 5.8, it errors out stating&lt;/P&gt;&lt;P&gt;"decimal specification must be less than the width specification". Can you please help. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data&amp;nbsp; temp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile "/directory/sample.txt" delimiter = '|' MISSOVER DSD&amp;nbsp; lrecl=32767 firstobs=2&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; INPUT &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; VAR1&amp;nbsp;&amp;nbsp;&amp;nbsp; :10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; VAR2&amp;nbsp;&amp;nbsp;&amp;nbsp; :6.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; FORMAT &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; VAR1&amp;nbsp;&amp;nbsp;&amp;nbsp; 9.19&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; VAR2&amp;nbsp;&amp;nbsp;&amp;nbsp; 5.8&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 07:00:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212214#M52417</guid>
      <dc:creator>sree12</dc:creator>
      <dc:date>2015-07-28T07:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal specification</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212215#M52418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you give us an example of the values you're trying to read and how you want them to be formatted please. With 9.19 you're asking SAS to give you 19 decimal places with a total width of only 9, so it doesn't work. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 14:23:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212215#M52418</guid>
      <dc:creator>evp000</dc:creator>
      <dc:date>2015-07-28T14:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal specification</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212216#M52419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Format specification is w.d&lt;/P&gt;&lt;P&gt;&lt;SPAN class="strong" style="font-weight: bold;"&gt;&lt;SPAN class="strongEmph" style="font-style: italic;"&gt;w&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a000841385" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the width of the output field.&lt;/P&gt;&lt;TABLE cellpadding="4" cellspacing="2"&gt;&lt;TBODY style="font-family: inherit;"&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Range:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a000841386" style="font-family: inherit;"&gt;&lt;/A&gt;1-32&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Tip:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a000841387" style="font-family: inherit;"&gt;&lt;/A&gt;Allow enough space to write the value, the decimal point, and a minus sign, if necessary.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN class="strong" style="font-weight: bold;"&gt;&lt;A name="a000841388" style="font-weight: normal; font-family: inherit;"&gt;&lt;/A&gt;&lt;SPAN class="strongEmph" style="font-style: italic;"&gt;d&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0 0 1.4em;"&gt;&lt;A name="a000841389" style="font-family: inherit;"&gt;&lt;/A&gt;specifies the number of digits to the right of the decimal point in the numeric value. This argument is optional.&lt;/P&gt;&lt;TABLE cellpadding="4" cellspacing="2"&gt;&lt;TBODY style="font-family: inherit;"&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Range:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a000841390" style="font-family: inherit;"&gt;&lt;/A&gt;0-31&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Requirement:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a002892221" style="font-family: inherit;"&gt;&lt;/A&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;must be less than &lt;SPAN class="strongEmph" style="font-style: italic;"&gt;w&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="font-family: inherit;" valign="top"&gt;&lt;TD align="left" class="label" nowrap="nowrap" style="font-weight: bold; background-color: #f5f5f5;" width="95"&gt;Tip:&lt;/TD&gt;&lt;TD align="left" class="bgBlockLight" style="background-color: #f5f5f5;"&gt;&lt;A name="a000841391" style="font-family: inherit;"&gt;&lt;/A&gt;If &lt;SPAN class="strongEmph" style="font-weight: bold; font-style: italic;"&gt;d&lt;/SPAN&gt; is 0 or you omit &lt;SPAN class="strongEmph" style="font-weight: bold; font-style: italic;"&gt;d&lt;/SPAN&gt;, &lt;SPAN class="strongEmph" style="font-weight: bold; font-style: italic;"&gt;w&lt;/SPAN&gt;.&lt;SPAN class="strongEmph" style="font-weight: bold; font-style: italic;"&gt;d&lt;/SPAN&gt; writes the value without a decimal point.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, 'Arial Unicode MS', geneva, 'Lucida Grande', sans-serif; font-size: 13.4399995803833px; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199377.htm" title="https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199377.htm"&gt;SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;W = 8.2&lt;/P&gt;&lt;P&gt;WWWWW.DD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I don't think you can have 19 decimal places, IEEE floating point number rules.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 15:36:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212216#M52419</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-07-28T15:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal specification</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212217#M52420</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you think 9.19 means?&amp;nbsp; Is that 9 digits before the decimal point + the decimal point + 19 digits after the decimal point? &lt;/P&gt;&lt;P&gt;If so then the width of that field will be 29 characters with 28 digits of precision.&amp;nbsp; &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;So in your FORMAT statement you should use 29.19 (which can also be written as F29.19).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;But y&lt;/SPAN&gt;&lt;SPAN style="font-size: 13.3333330154419px; line-height: 1.5em;"&gt;ou cannot store 28 digits of precision in a floating point number. &lt;/SPAN&gt;So either&lt;/P&gt;&lt;P&gt;1) Remove the format for that variable from the INPUT statement. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; SAS will then just do the best it can to convert the data it sees into a floating point number. You might lose some digits of precision.&lt;/P&gt;&lt;P&gt;2) Read it as character.&amp;nbsp; You could do that by using :$29.&amp;nbsp; as the format on the INPUT statement.&amp;nbsp; There is no need to attach a format to character variables in your FORMAT statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 16:29:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212217#M52420</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-07-28T16:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Decimal specification</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212218#M52421</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS uses 8 byte floating point for numeric variables, which provides a maximum of 15 significant digits. If you need more, you'll have to capture the data as character, but you won't be able to perform calculations on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Jul 2015 16:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Decimal-specification/m-p/212218#M52421</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2015-07-28T16:34:02Z</dc:date>
    </item>
  </channel>
</rss>

