<?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: Use infile to load large CSV file, but 0 records read from file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934845#M367570</link>
    <description>&lt;P&gt;Your TERMSTR is probably wrong, try LF (UNIX) or CR (Max) instead.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jul 2024 19:48:10 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2024-07-05T19:48:10Z</dc:date>
    <item>
      <title>Use infile to load large CSV file, but 0 records read from file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934832#M367566</link>
      <description>&lt;P&gt;%macro infile;&lt;/P&gt;&lt;P&gt;%Do Yr .= &amp;amp;strYr %To EndYr;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filename caseA "&amp;amp;sourcefile.\caseA_&amp;amp;Yr..CSV";&lt;/P&gt;&lt;P&gt;Data temp. caseA_&amp;amp;Yr.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;length&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Filr_number $ 15&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtn_cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$4&lt;/P&gt;&lt;P&gt;... ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; infile casA Firstobs = 2 DSD Termstr = CRLF DLM =',' LRECL=32767 Missover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; input&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Filr_number $&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtn_cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $&lt;/P&gt;&lt;P&gt;...;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; informat&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Filr_number $CHAR15.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtn_cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$CHAR1.&lt;/P&gt;&lt;P&gt;...;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; format&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Filr_number $CHAR15.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtn_cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$CHAR1.&lt;/P&gt;&lt;P&gt;...;&lt;/P&gt;&lt;P&gt;&amp;nbsp;run;&lt;/P&gt;&lt;P&gt;%END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Mend;&lt;/P&gt;&lt;P&gt;%infile;&lt;/P&gt;&lt;DIV class=""&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;NOTE: The infile CaseA is:&lt;BR /&gt;Filename=E:\Master file\CaseA_2020.CSV,&lt;BR /&gt;RECFM=V,LRECL=32767,&lt;BR /&gt;File Size (bytes)=8571503098,&lt;BR /&gt;Last Modified=May 29, 2024 14:16:42,&lt;BR /&gt;Create Time=May 29, 2024 14:16:42&lt;/P&gt;&lt;P&gt;NOTE: 0 records were read from the infile CaseA.&lt;BR /&gt;NOTE: The data set temp.CaseA_2020 has 0 observations and 120 variables.&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 18:54:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934832#M367566</guid>
      <dc:creator>SAS_usercanada</dc:creator>
      <dc:date>2024-07-05T18:54:58Z</dc:date>
    </item>
    <item>
      <title>Re: Use infile to load large CSV file, but 0 records read from file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934839#M367567</link>
      <description>&lt;P&gt;Your filename is cas&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;E&lt;/STRONG&gt;&lt;/FONT&gt;a and your infile is CasA (missing E) but could be&amp;nbsp; a typo here?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you add the macro debugging options and post the full log?&lt;/P&gt;
&lt;P&gt;Also, make sure the file has the data expected (open the CSV file or use a basic input to read a few lines).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macro debugging options&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint mlogic;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check the actual file contents:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
infile 'path to csv file no macro variables.csv' dsd firstobs=2 dsd termstr = crlf dlm=',' lrecl=32767 missover;

input;

put _infile_;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/271176"&gt;@SAS_usercanada&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;%macro infile;&lt;/P&gt;
&lt;P&gt;%Do Yr .= &amp;amp;strYr %To EndYr;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Filename caseA "&amp;amp;sourcefile.\caseA_&amp;amp;Yr..CSV";&lt;/P&gt;
&lt;P&gt;Data temp. caseA_&amp;amp;Yr.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;length&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Filr_number $ 15&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtn_cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$4&lt;/P&gt;
&lt;P&gt;... ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; infile casA Firstobs = 2 DSD Termstr = CRLF DLM =',' LRECL=32767 Missover;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; input&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Filr_number $&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtn_cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $&lt;/P&gt;
&lt;P&gt;...;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; informat&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Filr_number $CHAR15.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtn_cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$CHAR1.&lt;/P&gt;
&lt;P&gt;...;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; format&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Filr_number $CHAR15.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rtn_cd&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$CHAR1.&lt;/P&gt;
&lt;P&gt;...;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;run;&lt;/P&gt;
&lt;P&gt;%END;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%Mend;&lt;/P&gt;
&lt;P&gt;%infile;&lt;/P&gt;
&lt;DIV class=""&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;NOTE: The infile CaseA is:&lt;BR /&gt;Filename=E:\Master file\CaseA_2020.CSV,&lt;BR /&gt;RECFM=V,LRECL=32767,&lt;BR /&gt;File Size (bytes)=8571503098,&lt;BR /&gt;Last Modified=May 29, 2024 14:16:42,&lt;BR /&gt;Create Time=May 29, 2024 14:16:42&lt;/P&gt;
&lt;P&gt;NOTE: 0 records were read from the infile CaseA.&lt;BR /&gt;NOTE: The data set temp.CaseA_2020 has 0 observations and 120 variables.&lt;/P&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 19:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934839#M367567</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-07-05T19:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Use infile to load large CSV file, but 0 records read from file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934842#M367568</link>
      <description>It is my typo here.</description>
      <pubDate>Fri, 05 Jul 2024 19:40:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934842#M367568</guid>
      <dc:creator>SAS_usercanada</dc:creator>
      <dc:date>2024-07-05T19:40:19Z</dc:date>
    </item>
    <item>
      <title>Re: Use infile to load large CSV file, but 0 records read from file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934844#M367569</link>
      <description>&lt;P&gt;So from your SAS log we have the following information:&lt;/P&gt;
&lt;PRE&gt;File Size (bytes)=8571503098
NOTE: 0 records were read from the infile CaseA.&lt;/PRE&gt;
&lt;P&gt;And since your INFILE statement said to start reading on the second observation that means that all&amp;nbsp;8,571,503,098 bytes are part of the first observation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you sure this is a CSV (which is a TEXT file)?&amp;nbsp; Are you sure the CSV file is using CR+LF ('0D0A'x) to mark the end of the lines?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How long to you expect each line to be?&amp;nbsp; Try reading a little more than that many bytes from the file and see if you tell whether it is a text file and if so what character(s) are being used to mark the end of the lines of text.&amp;nbsp; So if you expect the header line to be 400 characters and the first data line to be 300 characters you might try reading in just the first 1000 characters and looking to see if there are any CR or LF characters in there.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'E:\Master file\CaseA_2020.CSV' lrecl=100 recfm=f obs=10;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Perhaps the file is from a Unix machine so it only use LF as the end of line character.&amp;nbsp; Change the TERMSTR= option.&amp;nbsp; PS It is almost never the case that you want the behavior of the ancient MISSOVER option.&amp;nbsp; Usually you will want the behavior of the new (probably only 30+ years old by now) TRUNCOVER option instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile casA Firstobs = 2 DSD Termstr = LF DLM =',' LRECL=32767 TRUNCOVER;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If someone accidentally let Excel on a Mac create the CSV file without paying attention to what file format it was going to use it might have been created using CR only as the end of line marker.&amp;nbsp; (Somehow Excel never learned that MacOS is now a UNIX version and should be use LF as the end of line character.)&amp;nbsp; If that is the case then add the TERMSTR=CR option to the INFILE statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile casA Firstobs = 2 DSD Termstr = CR DLM =',' LRECL=32767 TRUNCOVER;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Jul 2024 19:46:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934844#M367569</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-07-05T19:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: Use infile to load large CSV file, but 0 records read from file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934845#M367570</link>
      <description>&lt;P&gt;Your TERMSTR is probably wrong, try LF (UNIX) or CR (Max) instead.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 19:48:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Use-infile-to-load-large-CSV-file-but-0-records-read-from-file/m-p/934845#M367570</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-07-05T19:48:10Z</dc:date>
    </item>
  </channel>
</rss>

