<?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 Importing a CSV file using infile statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260523#M50563</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code to import a CSV file into SAS. The CSV file has an ID variable, which is character, and a numeric variable which is numbers from 1-100 with 2 decimal places.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I'm using :&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;%let _EFIERR_ = 0;&lt;BR /&gt;infile 'filepath\file.csv'&lt;BR /&gt;delimiter = ',' DSD MISSOVER lrecl=32767 firstobs=2;&lt;BR /&gt;INFORMAT ID &amp;nbsp;$CHAR6.;&lt;BR /&gt;INFORMAT num_var&amp;nbsp;8.2;&lt;/P&gt;&lt;P&gt;****************************************************************;&lt;BR /&gt;FORMAT ID&amp;nbsp;$CHAR6.;&lt;BR /&gt;FORMAT num_var&amp;nbsp;8.2;&lt;/P&gt;&lt;P&gt;INPUT&lt;BR /&gt;ID&amp;nbsp;$&lt;BR /&gt;num_var;&lt;BR /&gt;&lt;BR /&gt;if _ERROR_ then call symput('_EFIERR_',1);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I keep getting an error message which says Invalid data for my numeric var, which seems to be when it has missing values in the Excel spreadsheet. I thought that the MISSOVER option was supposed to deal with that, but apparently not. Is my formatting off? Any help is much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Thu, 31 Mar 2016 19:34:06 GMT</pubDate>
    <dc:creator>Walternate</dc:creator>
    <dc:date>2016-03-31T19:34:06Z</dc:date>
    <item>
      <title>Importing a CSV file using infile statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260523#M50563</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code to import a CSV file into SAS. The CSV file has an ID variable, which is character, and a numeric variable which is numbers from 1-100 with 2 decimal places.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I'm using :&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;%let _EFIERR_ = 0;&lt;BR /&gt;infile 'filepath\file.csv'&lt;BR /&gt;delimiter = ',' DSD MISSOVER lrecl=32767 firstobs=2;&lt;BR /&gt;INFORMAT ID &amp;nbsp;$CHAR6.;&lt;BR /&gt;INFORMAT num_var&amp;nbsp;8.2;&lt;/P&gt;&lt;P&gt;****************************************************************;&lt;BR /&gt;FORMAT ID&amp;nbsp;$CHAR6.;&lt;BR /&gt;FORMAT num_var&amp;nbsp;8.2;&lt;/P&gt;&lt;P&gt;INPUT&lt;BR /&gt;ID&amp;nbsp;$&lt;BR /&gt;num_var;&lt;BR /&gt;&lt;BR /&gt;if _ERROR_ then call symput('_EFIERR_',1);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I keep getting an error message which says Invalid data for my numeric var, which seems to be when it has missing values in the Excel spreadsheet. I thought that the MISSOVER option was supposed to deal with that, but apparently not. Is my formatting off? Any help is much appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 19:34:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260523#M50563</guid>
      <dc:creator>Walternate</dc:creator>
      <dc:date>2016-03-31T19:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a CSV file using infile statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260527#M50566</link>
      <description>&lt;P&gt;Post a few rows of the data that duplicate the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 19:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260527#M50566</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-31T19:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a CSV file using infile statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260529#M50567</link>
      <description>&lt;P&gt;Additionally, my IDs are 6 characters long (max) but it's only reading 2 or 3 characters in the output data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The input data looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp; num_var&lt;/P&gt;&lt;P&gt;111 &amp;nbsp; &amp;nbsp; 12.83&lt;/P&gt;&lt;P&gt;222 &amp;nbsp; &amp;nbsp; 93.21&lt;/P&gt;&lt;P&gt;333 &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From what I can tell from the log, it's the ones where num_var is missing that are causing the error message issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 19:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260529#M50567</guid>
      <dc:creator>Walternate</dc:creator>
      <dc:date>2016-03-31T19:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a CSV file using infile statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260531#M50568</link>
      <description>&lt;P&gt;Invalid data is data that cannot be read a number by the format in this case 8.2. &amp;nbsp;You should the output in the log that allow you to see the problem in the data line(s).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show that part of the log to the group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;also points out:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Also, you should know about the 8.2 informat.&amp;nbsp; If your incoming value is 100, the result will be 1, not 100.&amp;nbsp; The 8.2 informat expects to find a decimal point.&amp;nbsp; But if it doesn't find one, it inserts one and puts two digits after the decimal point.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 12 Jan 2018 14:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260531#M50568</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2018-01-12T14:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a CSV file using infile statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260549#M50577</link>
      <description>We would be greatly helped with some sample data. But from what you tell it looks like TRUNCOVER will deal with this rather than MISSOVER.&lt;BR /&gt;&lt;BR /&gt;- Jan.</description>
      <pubDate>Thu, 31 Mar 2016 20:39:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260549#M50577</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-03-31T20:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a CSV file using infile statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260556#M50578</link>
      <description>&lt;P&gt;TRUNCOVER is not for LIST input it is for formatted or column input. &amp;nbsp;Although it works the same as MISSOVER for list input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Truncover was invented for folks who coundn't figure out how to read variable length records.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 21:14:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260556#M50578</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-03-31T21:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a CSV file using infile statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260570#M50585</link>
      <description>&lt;P&gt;It would be helpful to know what is in the incoming data line.&amp;nbsp; That would explain what's in the invalid data.&amp;nbsp; Perhaps it's not being treated as a blank but actually contains some other character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, you should know about the 8.2 informat.&amp;nbsp; If your incoming value is 100, the result will be 1, not 100.&amp;nbsp; The 8.2 informat expects to find a decimal point.&amp;nbsp; But if it doesn't find one, it inserts one and puts two digits after the decimal point.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 21:50:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260570#M50585</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-31T21:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a CSV file using infile statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260573#M50586</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37814"&gt;@Walternate&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Additionally, my IDs are 6 characters long (max) but it's only reading 2 or 3 characters in the output data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The input data looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ID &amp;nbsp; &amp;nbsp; &amp;nbsp; num_var&lt;/P&gt;
&lt;P&gt;111 &amp;nbsp; &amp;nbsp; 12.83&lt;/P&gt;
&lt;P&gt;222 &amp;nbsp; &amp;nbsp; 93.21&lt;/P&gt;
&lt;P&gt;333 &amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From what I can tell from the log, it's the ones where num_var is missing that are causing the error message issue.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your infile statement says the data is comma delimited but your example doesn't show any comma. I think you need to show the actual log with code and error messages.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2016 22:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260573#M50586</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-31T22:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a CSV file using infile statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260615#M50607</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15410"&gt;@data_null__&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;TRUNCOVER is not for LIST input it is for formatted or column input. &amp;nbsp;Although it works the same as MISSOVER for list input.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Truncover was invented for folks who coundn't figure out how to read variable length records.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Don't be so harsh. TRUNCOVER is needed when reading VB files from z/OS mainframes. All columns except the last one are fixed length, and no delimiters are present. TRUNCOVER allows a simple formatted input statement in such cases.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Apr 2016 06:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-CSV-file-using-infile-statement/m-p/260615#M50607</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-04-01T06:00:55Z</dc:date>
    </item>
  </channel>
</rss>

