<?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: Import CSV File with some empty rows in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948120#M42588</link>
    <description>&lt;P&gt;Looks like IMPORT incorrectly&amp;nbsp;&lt;EM&gt;guessed&lt;/EM&gt; ID to be numeric. Given that this column seems to be 24 characters long, this would on its own cause problems as SAS can only store numbers correctly up to 15 decimal digits.&lt;/P&gt;
&lt;P&gt;ID values should always be read as character.&lt;/P&gt;</description>
    <pubDate>Fri, 18 Oct 2024 19:41:49 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2024-10-18T19:41:49Z</dc:date>
    <item>
      <title>Import CSV File with some empty rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948115#M42585</link>
      <description>&lt;P&gt;I used the following line of codes to import a large CSV files ( &amp;gt; 10 million of rows):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc import datafile = "\path\file.csv" dmbs=csv out=file replace; run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the log I received:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note: "Invalid data for ID in line 10158465 1-24. ID =. TYPE = .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error: "Import unsuccessful."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The first 13,402,830 rows were imported successfully. Based on the log, my understanding is the next few rows in the file are empty. Since the file is too large to open in Notepad or Excel, I can't verify if there are additional data beyond the empty rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I ensure that all rows, including any empty rows or rows that may follow, are imported properly?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 18:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948115#M42585</guid>
      <dc:creator>plllu</dc:creator>
      <dc:date>2024-10-18T18:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV File with some empty rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948116#M42586</link>
      <description>&lt;P&gt;Empty lines do not normally cause errors like that.&amp;nbsp; Instead it would just cause the variables to all have missing values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no need to open the file in Excel or an Editor.&amp;nbsp; You can just use a data step to read the file and see if your hypothesis about the empty lines is correct.&amp;nbsp; For example you could use the FIRSTOBS= and OBS= options on the INFILE statement to look around near the line you mentioned.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile "\path\file.csv" firstobs=10158464 obs=10158470;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would never use PROC IMPORT to read such a large file.&lt;/P&gt;
&lt;P&gt;You might use it to help you GUESS how to read the file, but once you know what the variables are (and what type and storage length they need) just write the DATA step to read the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 18:57:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948116#M42586</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-18T18:57:06Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV File with some empty rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948118#M42587</link>
      <description>&lt;P&gt;Do not use PROC IMPORT if you don't have to. Write the DATA step to read the file yourself, according to the documentation of the file. That way you do not have to fix all the mistakes caused by the&amp;nbsp;&lt;EM&gt;guessing&lt;/EM&gt; of PROC IMPORT.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 19:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948118#M42587</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-10-18T19:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV File with some empty rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948120#M42588</link>
      <description>&lt;P&gt;Looks like IMPORT incorrectly&amp;nbsp;&lt;EM&gt;guessed&lt;/EM&gt; ID to be numeric. Given that this column seems to be 24 characters long, this would on its own cause problems as SAS can only store numbers correctly up to 15 decimal digits.&lt;/P&gt;
&lt;P&gt;ID values should always be read as character.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Oct 2024 19:41:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948120#M42588</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-10-18T19:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: Import CSV File with some empty rows</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948148#M42589</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;STRONG&gt;Note: "Invalid data for ID in line 10158465 1-24. ID =. TYPE = .&lt;/STRONG&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Does the CSV file really only have two columns?&amp;nbsp; Definitely do NOT use PROC IMPORT in that case.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  infile "\path\file.csv" dsd truncover firstobs=2;
  length id $30 type $20 ;
  input id type;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And if it does have more columns the data step code is not really any harder.&lt;/P&gt;</description>
      <pubDate>Sat, 19 Oct 2024 00:17:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Import-CSV-File-with-some-empty-rows/m-p/948148#M42589</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-19T00:17:38Z</dc:date>
    </item>
  </channel>
</rss>

