<?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 Numeric format when importing CSV: lost zeros for intergers in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Numeric-format-when-importing-CSV-lost-zeros-for-intergers/m-p/651518#M78763</link>
    <description>&lt;P&gt;I imported a CSV file into SAS using the infile command. There was no error reported. Today I found an error in the imported dataset. In the CSV file, there is a numeric variable whose values are floating numbers (e.g., 3828443.49) in some rows and intergers (e.g., 3500000) in other rows. In the import code, I specified&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat my_var 12.2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, this introduced&amp;nbsp;errors. While the floating numbers are correctly imported, those intergers ending with multiple zeros got truncated. It seems that many of them lost the last 2 zeros. So my question is, what is a good practice for avoiding this numeric issue when importing CSV files?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 May 2020 19:12:21 GMT</pubDate>
    <dc:creator>xyxu</dc:creator>
    <dc:date>2020-05-28T19:12:21Z</dc:date>
    <item>
      <title>Numeric format when importing CSV: lost zeros for intergers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Numeric-format-when-importing-CSV-lost-zeros-for-intergers/m-p/651518#M78763</link>
      <description>&lt;P&gt;I imported a CSV file into SAS using the infile command. There was no error reported. Today I found an error in the imported dataset. In the CSV file, there is a numeric variable whose values are floating numbers (e.g., 3828443.49) in some rows and intergers (e.g., 3500000) in other rows. In the import code, I specified&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat my_var 12.2&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, this introduced&amp;nbsp;errors. While the floating numbers are correctly imported, those intergers ending with multiple zeros got truncated. It seems that many of them lost the last 2 zeros. So my question is, what is a good practice for avoiding this numeric issue when importing CSV files?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 19:12:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Numeric-format-when-importing-CSV-lost-zeros-for-intergers/m-p/651518#M78763</guid>
      <dc:creator>xyxu</dc:creator>
      <dc:date>2020-05-28T19:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Numeric format when importing CSV: lost zeros for intergers</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Numeric-format-when-importing-CSV-lost-zeros-for-intergers/m-p/651521#M78764</link>
      <description>&lt;P&gt;Specifying an informat of 12.2 means you expect the data to always have 2 decimal spaces when being read.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So&amp;nbsp;35000 read with 12.2 would return 350.00 which is why you're losing your last two values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should likely read it as 8. and then format it as 8.2?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/99650"&gt;@xyxu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I imported a CSV file into SAS using the infile command. There was no error reported. Today I found an error in the imported dataset. In the CSV file, there is a numeric variable whose values are floating numbers (e.g., 3828443.49) in some rows and intergers (e.g., 3500000) in other rows. In the import code, I specified&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;informat my_var 12.2&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;However, this introduced&amp;nbsp;errors. While the floating numbers are correctly imported, those intergers ending with multiple zeros got truncated. It seems that many of them lost the last 2 zeros. So my question is, what is a good practice for avoiding this numeric issue when importing CSV files?&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 May 2020 19:19:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Numeric-format-when-importing-CSV-lost-zeros-for-intergers/m-p/651521#M78764</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-05-28T19:19:41Z</dc:date>
    </item>
  </channel>
</rss>

