<?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: Problems Importing .dat file into SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problems-Importing-dat-file-into-SAS/m-p/733851#M228671</link>
    <description>&lt;P&gt;Did the source of the file provide a description any where?&lt;/P&gt;
&lt;P&gt;As long as your LRECL is at least 9000 that would not have any issue. RECFM likely wouldn't have any issue either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What tells you that you have 2500000 observations in the source file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to post the entire data step from the log along with any other messages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Apr 2021 17:17:06 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-04-14T17:17:06Z</dc:date>
    <item>
      <title>Problems Importing .dat file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-Importing-dat-file-into-SAS/m-p/733835#M228668</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since this is my first message, I would like thank you to all the SAS community, because I learnt a lot (still I need a lot to learn...) with this forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been importing many delimited files succesfully, but I'm struggling to import a .dat file without delimiters (with "fixed width"). The file has almost 2500000 observations, but SAS only reads 1431879. If I set up option "firstobs = 1431880" to read the next observation, SAS doesn't read anything. When I read the first 1431879 obs, the file looks "good" (all vars seems to be ok) but, you know, "a few" rows are missing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been also trying with truncover, missover, etc. but nothing worked...&amp;nbsp; Also changed&amp;nbsp;RECFM&amp;nbsp; and LRECL options, but found none that worked for me (I'm not used with these options, though). As you can see, I'm a newbie (just switching to SAS), and I've been reading a lot of information but I didn't succeed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help, please?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA want;
infile "C:\filename.DAT"&amp;nbsp; truncover;
input VAR1$ 1-1
VAR2 2-9
VAR3 10-14
VAR4 15-19
VAR5 20-21
VAR6 22-23
VAR7 24-27
VAR8 28-29;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PD: The file has hundreds of vars (I just wrote an example) but, in case it might help, the original .dat file contains data like this (it's not a delimited file):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;A123456789121
B125455479121&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Marc&lt;/P&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;P&gt;EDIT: This is the log I get:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;NOTE: The infile "C:\filename.DAT" is:
      Nombre archivo=C:\filename.DAT,
      RECFM=V,LRECL=32767,
      Tamaño de archivo (bytes)=25841609304,
      Última modificación=04 de abril de 2021 21H44,
      Create Time=04 de febrero de 2014 14H51

NOTE: 1431879 records were read from the infile "C:\filename.DAT".
      The minimum record length was 665.
      The maximum record length was 9000.
NOTE: The data set WORK.WANT has 1431879 observations and 8 variables.
NOTE: Sentencia DATA used (Total process time):
      real time           1:24.44
      cpu time            25.87 seconds
      &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Apr 2021 16:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-Importing-dat-file-into-SAS/m-p/733835#M228668</guid>
      <dc:creator>marcjj</dc:creator>
      <dc:date>2021-04-14T16:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problems Importing .dat file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-Importing-dat-file-into-SAS/m-p/733851#M228671</link>
      <description>&lt;P&gt;Did the source of the file provide a description any where?&lt;/P&gt;
&lt;P&gt;As long as your LRECL is at least 9000 that would not have any issue. RECFM likely wouldn't have any issue either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What tells you that you have 2500000 observations in the source file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may want to post the entire data step from the log along with any other messages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 17:17:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-Importing-dat-file-into-SAS/m-p/733851#M228671</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-14T17:17:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problems Importing .dat file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-Importing-dat-file-into-SAS/m-p/733881#M228677</link>
      <description>&lt;P&gt;So based on those numbers the job is stopping before the full file is read.&lt;/P&gt;
&lt;PRE&gt;2787  data check;
2788    bytes = 25841609304 ;
2789    records = 1431879 ;
2790    average = bytes / records ;
2791    min = 665 ;
2792    max = 9000 ;
2793    put (_all_) (= comma20. /);
2794  run;

bytes=25,841,609,304
records=1,431,879
average=18,047
min=665
max=9,000
&lt;/PRE&gt;
&lt;P&gt;So probably you have the DOS end of file character about half way through the file and SAS is seeing that as marking the end of the file.&amp;nbsp; &lt;A href="https://communities.sas.com/t5/SAS-Programming/Reading-a-text-file-with-embedded-EOF-characters-in-it/td-p/359606" target="_self"&gt;Tell it to ignore the DOS end of file character.&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;infile "C:\filename.DAT"  truncover ignoredoseof;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 14 Apr 2021 17:58:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-Importing-dat-file-into-SAS/m-p/733881#M228677</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-04-14T17:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Problems Importing .dat file into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-Importing-dat-file-into-SAS/m-p/733888#M228679</link>
      <description>&lt;P&gt;Thank you very much!!!! I used the &lt;STRONG&gt;&lt;EM&gt;ignoredoseof&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;option, and it worked! SAS read the whole file!&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 18:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-Importing-dat-file-into-SAS/m-p/733888#M228679</guid>
      <dc:creator>marcjj</dc:creator>
      <dc:date>2021-04-14T18:33:27Z</dc:date>
    </item>
  </channel>
</rss>

