<?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: How to read a .d file with long character across multiple line? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374393#M89636</link>
    <description>thz for reply, can you show me how to write a small C filter program please?</description>
    <pubDate>Mon, 10 Jul 2017 07:48:35 GMT</pubDate>
    <dc:creator>hinear</dc:creator>
    <dc:date>2017-07-10T07:48:35Z</dc:date>
    <item>
      <title>How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374384#M89632</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got some problem when I am trying to import the .d data. The data contains a very long characters. Although&amp;nbsp;it is&amp;nbsp;covered by open and close quotation mark, SAS is not able to recognise it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;For example: Content of&amp;nbsp;the data (test.d)&lt;/U&gt;&lt;/P&gt;&lt;P&gt;"Row1" "A AAAAAAAAAAAAAAAAAAAAAAAAA&lt;/P&gt;&lt;P&gt;BBBBBBBBBBBC&lt;/P&gt;&lt;P&gt;CCCCCCCCCCCCCCCC"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Row2" &amp;nbsp;"A AAAAAAAAAAAAAAAAAAAAAAAAA&lt;/P&gt;&lt;P&gt;BBBBBBBBBBBC&lt;/P&gt;&lt;P&gt;CCCCCCCCCCCCCCCC"&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;My SAS code :-&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; test;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; _EFIERR_ = 0; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;infile&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;"&amp;amp;ImportLocation.test.d"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;delimiter&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;' '&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;MISSOVER&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DSD&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;lrecl&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;32767&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;informat&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;Var1 $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;Var2&amp;nbsp;$ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;999.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;format&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New"&gt;Var1&lt;/FONT&gt; $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;4.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New"&gt;Var2&lt;/FONT&gt; $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;999.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;input&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;FONT face="Courier New"&gt;Var1 $ &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New"&gt;Var2&lt;/FONT&gt; $ &lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&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;&lt;U&gt;Output&amp;nbsp; :-&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Var1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Var2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Row1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "A&lt;/P&gt;&lt;P&gt;BBBB&lt;/P&gt;&lt;P&gt;CCCC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Row2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;"A&lt;/P&gt;&lt;P&gt;BBBB&lt;/P&gt;&lt;P&gt;CCCC&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is not able to read the full content inside Variables2, the open and close quotation mark is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I adjust my SAS code to read the data in variables2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thz&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 06:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374384#M89632</guid>
      <dc:creator>hinear</dc:creator>
      <dc:date>2017-07-10T06:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374386#M89633</link>
      <description>&lt;P&gt;When reading from text files, the line separator takes precedence over the quotes that denote columns. I solved the problem by writing a small C filter program that replaces linefeeds with a &amp;lt;BR&amp;gt; tag everywhere the count of quotes is uneven.&lt;/P&gt;
&lt;P&gt;But I think there is a solution with using recfm=n and reading the instream column by column.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 06:51:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374386#M89633</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-10T06:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374393#M89636</link>
      <description>thz for reply, can you show me how to write a small C filter program please?</description>
      <pubDate>Mon, 10 Jul 2017 07:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374393#M89636</guid>
      <dc:creator>hinear</dc:creator>
      <dc:date>2017-07-10T07:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374394#M89637</link>
      <description>&lt;P&gt;This is the source of the code:&lt;/P&gt;
&lt;PRE&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;unistd.h&amp;gt;

main (argc,argv)
int argc;
char *argv[];
{
        FILE *ifp;
        FILE *ofp;
        int c;
        int flag;
        int iflag = 0;
        int oflag = 0;
        char *infile = NULL;
        char *outfile = NULL;
        opterr = 0;
        while ((c = getopt(argc,argv,"i:o:")) != -1)
                switch (c) {
                        case 'i':
                                iflag = 1;
                                infile = optarg;
                                break;
                        case 'o':
                                oflag = 1;
                                outfile = optarg;
                                break;
                        case '?':
                                if (optopt == 'c')
                                fprintf (stderr, "Option -%c requires an argumen
t.\n", optopt);
                                else if (isprint (optopt))
                                fprintf (stderr, "Unknown option `-%c'.\n", opto
pt);
                                else
                                fprintf (stderr,
                                "Unknown option character `\\x%x'.\n",
                                optopt);
                                return 1;
                }
        if (iflag == 1) {
                ifp = fopen(infile,"r");
                if (ifp == NULL) {
                        fprintf(stderr, "could not open infile %s\n",infile);
                        return 2;
                }
        }
        else {
                ifp = stdin;
        }
        if (oflag == 1) {
                ofp = fopen(outfile,"w");
                if (ofp == NULL) {
                        fprintf(stderr, "could not open outfile %s\n",outfile);
                        return 3;
                }
                else {
                        fprintf(stdout,"converting %s to %s\n",infile,outfile);
                }
        }
        else {
                ofp = stdout;
        }

        flag = 0;
        while ((c = fgetc(ifp)) != EOF ) {
                if (c == 39) {
                        flag = abs(flag - 1);
                }
                if ((c == 10) &amp;amp;&amp;amp; (flag == 1)) {
                        fputc('&amp;lt;',ofp);
                        fputc('B',ofp);
                        fputc('R',ofp);
                        fputc('&amp;gt;',ofp);
                }
                else {
                        fputc(c,ofp);
                }
        }
}
&lt;/PRE&gt;
&lt;P&gt;It uses the standard C function getopt() to retrieve the commandline arguments (infile and outfile names); if no name is supplied, stdin and/or stdout are used, respectively.&lt;/P&gt;
&lt;P&gt;The main program starts at flag = 0; and just loops until all bytes are read.&lt;/P&gt;
&lt;P&gt;You need to have gcc and the basic C libraries installed to compile the code. You could also port the logic to any other programming lagnuage of your choice. The nice thing about C is the sheer speed of the executable.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 08:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374394#M89637</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-10T08:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374395#M89638</link>
      <description>&lt;P&gt;Just to add, its a good idea to name the file extension to directly reference what the file contains (e.g. Excel files are XLSX, Word is DOCX, SAS programs are SAS etc.). &amp;nbsp;.D is a file association with the D programming language, so naming your file this way can cause unusual effects. &amp;nbsp;If this is a text based delimited file, then .txt or .dlm or .csv (for comma delimited) should be used.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a SAS based solution (note, updated this slightly from the SAS support provided code from post:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/find-carriage-return-in-dataset/m-p/177855/highlight/true#M11981" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/find-carriage-return-in-dataset/m-p/177855/highlight/true#M11981&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Not tested it, but should work fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
     infile "s:\temp\rob\x.csv" recfm=n;
     file "s:\temp\rob\y.csv" recfm=n;
     retain flag 0;
     input a $char1.;
     if a = '"' then flag=ifn(flag=0,1,0);
     if not(flag=1 and a in ('0D'x,'0A'x)) then put a $char1.;
run;&lt;/PRE&gt;
&lt;P&gt;This reads in the file bit by bit,&amp;nbsp;and drops carriage return characters from the the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 08:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374395#M89638</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-10T08:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374396#M89639</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test(keep= Var1 Var2);
   length 
      Var1 $ 4 Var2 $ 999
      buffer $ 32000
      rx 8
   ;

   retain 
      buffer ' ' 
      rx 
   ;

   if _n_ = 1 then do;
      rx = prxparse('/"(.+)".*"(.+)"/');
   end;
      
   infile "&amp;amp;ImportLocation.test.d" delimiter=' ' MISSOVER DSD lrecl=32767; 
   input;

   if lengthn(_infile_) = 0 then delete;

   if countc(_infile_, '"') = 3 then do;
      buffer = _infile_;
   end;
   else do;
      buffer = cats(buffer, _infile_);
   end;

   if mod(countc(buffer, '"'), 2) = 0 then do;
      if prxmatch(rx, buffer) then do;
         Var1 = prxposn(rx, 1, buffer);
         Var2 = prxposn(rx, 2, buffer);
         output;
      end;
   end;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;just another idea ....&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 08:21:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374396#M89639</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-07-10T08:21:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374400#M89641</link>
      <description>&lt;P&gt;Unfortunately the file that I download from the Progress system is a .d file&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I cannot change it to .csv or .txt&amp;nbsp; &amp;gt;..&amp;lt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 08:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374400#M89641</guid>
      <dc:creator>hinear</dc:creator>
      <dc:date>2017-07-10T08:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374401#M89642</link>
      <description>&lt;P&gt;After downloading, &lt;U&gt;you&lt;/U&gt; can rename the file on &lt;U&gt;your&lt;/U&gt; computer to any extension you want, including .this_is_the_silliest_extension_I_could_come_up_with.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/153185"&gt;@hinear&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Unfortunately the file that I download from the Progress system is a .d file&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I cannot change it to .csv or .txt&amp;nbsp; &amp;gt;..&amp;lt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 09:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374401#M89642</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-07-10T09:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374432#M89653</link>
      <description>&lt;P&gt;Thank you very much, it is working. However, my data also contain some variables(number and date), which does not have open and close quotation mark.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;For example: Content of&amp;nbsp;the data (test.d)&lt;/U&gt;&lt;/P&gt;&lt;P&gt;"Row1" 123 24/09/2019&amp;nbsp;"A AAAAAAAAAAAAAAAAAAAAAAAAA&lt;/P&gt;&lt;P&gt;BBBBBBBBBBBC&lt;/P&gt;&lt;P&gt;CCCCCCCCCCCCCCCC"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Row2" 234 24/09/2019&amp;nbsp;"A AAAAAAAAAAAAAAAAAAAAAAAAA&lt;/P&gt;&lt;P&gt;BBBBBBBBBBBC&lt;/P&gt;&lt;P&gt;CCCCCCCCCCCCCCCC"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to apply the same logic on it?&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 10:40:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374432#M89653</guid>
      <dc:creator>hinear</dc:creator>
      <dc:date>2017-07-10T10:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374491#M89682</link>
      <description>&lt;P&gt;Try option recfm=n .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" color="#000080" face="Courier New"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="3" face="Courier New"&gt; test;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" color="#0000ff" face="Courier New"&gt;%let&lt;/FONT&gt;&lt;FONT size="3" face="Courier New"&gt; _EFIERR_ = 0; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" color="#0000ff" face="Courier New"&gt;infile&lt;/FONT&gt; &lt;FONT size="3" color="#800080" face="Courier New"&gt;"&amp;amp;ImportLocation.test.d"&lt;/FONT&gt; &lt;FONT size="3" color="#0000ff" face="Courier New"&gt;delimiter&lt;/FONT&gt;&lt;FONT size="3" face="Courier New"&gt;=&lt;/FONT&gt;&lt;FONT size="3" color="#800080" face="Courier New"&gt;' '&lt;/FONT&gt; &lt;FONT size="3" color="#0000ff" face="Courier New"&gt;MISSOVER&lt;/FONT&gt; &lt;FONT size="3" color="#0000ff" face="Courier New"&gt;DSD&lt;/FONT&gt; &lt;FONT size="3" color="#0000ff" face="Courier New"&gt;lrecl&lt;/FONT&gt;&lt;FONT size="3" face="Courier New"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#008080" face="Courier New"&gt;&lt;FONT color="#FF0000"&gt;3276700&lt;/FONT&gt; &lt;FONT color="#FF0000"&gt;recfm=n&lt;/FONT&gt; &lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="3" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" color="#0000ff" face="Courier New"&gt;informat&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" face="Courier New"&gt;&amp;nbsp;Var1 $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#008080" face="Courier New"&gt;4.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" face="Courier New"&gt;&amp;nbsp;Var2&amp;nbsp;$ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#008080" face="Courier New"&gt;999.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="3" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" color="#0000ff" face="Courier New"&gt;format&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" face="Courier New"&gt;&lt;FONT face="Courier New"&gt;Var1&lt;/FONT&gt; $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#008080" face="Courier New"&gt;4.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" face="Courier New"&gt;&lt;FONT face="Courier New"&gt;Var2&lt;/FONT&gt; $ &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT size="3" color="#008080" face="Courier New"&gt;999.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="3" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New"&gt;input&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;FONT face="Courier New"&gt;Var1 $ &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" face="Courier New"&gt;&lt;FONT face="Courier New"&gt;Var2&lt;/FONT&gt; $ &lt;FONT color="#FF0000"&gt;@@&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="3" color="#FF0000" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3" color="#000080" face="Courier New"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="3" face="Courier New"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 13:34:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374491#M89682</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-07-10T13:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374517#M89695</link>
      <description>&lt;P&gt;You should look at the file and see what it is actually using as the delimiter and as end of line&amp;nbsp;markers. &amp;nbsp;You can easily use SAS to do this if you do not have a text editor that can do it for you. &amp;nbsp;For example to list the 1,000 bytes of your file you could use code like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   infile 'myfile.d' lrecl=100 recfm=f obs=10;
   input;
   list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are lucky your file will have &amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt; at the end of a record and just &amp;lt;CR&amp;gt; or just &amp;lt;LF&amp;gt; as the splits in the middle of the long lines. For example like this:&lt;/P&gt;
&lt;PRE&gt;1213  data _null_;
1214    infile test lrecl=50 recfm=f obs=10;
1215    input;
1216    list;
1217  run;

NOTE: The infile TEST is:

      Filename=...
      RECFM=F,LRECL=50,File Size (bytes)=166,
      Last Modified=10Jul2017:10:17:30,
      Create Time=10Jul2017:10:17:30

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9--
1         "Row1" 123 24/09/2019 "A AAAAAAAAAAAAAAAAAAAAAAAAA

2   CHAR  .BBBBBBBBBBBC.CCCCCCCCCCCCCCCC".."Row2" 234 24/09/
    ZONE  04444444444440444444444444444420025673223332332332
    NUMR  D222222222223D33333333333333332DA22F7220234024F09F

3   CHAR  2019 "A AAAAAAAAAAAAAAAAAAAAAAAAA.BBBBBBBBBBBC.CCC
    ZONE  33332242444444444444444444444444404444444444440444
    NUMR  201902101111111111111111111111111D222222222223D333

4   CHAR  CCCCCCCCCCCCC".. 16
    ZONE  4444444444444200
    NUMR  33333333333332DA
NOTE: 4 records were read from the infile TEST.
&lt;/PRE&gt;
&lt;P&gt;So you could read it like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  infile test dsd dlm=' ' truncover termstr=crlf ;
  length var1 $10 var2 var3 8 var4 $1000 ;
  informat var3 ddmmyy.;
  format var3 yymmdd10.;
  input var1-var4 ;
  var4 = translate(var4,'||','0D0A'x);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10223iC463CB09258BDE21/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 14:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374517#M89695</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-10T14:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374798#M89781</link>
      <description>&lt;P&gt;Unfortunately, my data has &amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt; in the end of&amp;nbsp;each row.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Row1" 123 24/09/2019 "A AAAAAAAAAAAAAAAAAAAAAAAAA&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;BR /&gt;&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;BR /&gt;BBBBBBBBBBBC&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;BR /&gt;&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;BR /&gt;CCCCCCCCCCCCCCCC" &amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Row2" 234 24/09/2019 "A AAAAAAAAAAAAAAAAAAAAAAAAA&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;BR /&gt;&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;BR /&gt;BBBBBBBBBBBC&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;BR /&gt;&amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;BR /&gt;CCCCCCCCCCCCCCCC" &amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used your SAS code, but the output look like the following:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" cellspacing="1" cellpadding="2"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;var1&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;var2&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;var3&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;var4&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;Row1&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P align="right"&gt;&lt;FONT face="Calibri" size="3"&gt;123&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P align="right"&gt;&lt;FONT face="Calibri" size="3"&gt;2019-09-24&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;"A&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;BBBBBBBBBB&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;CCCCCCCCCC&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;Row2&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P align="right"&gt;&lt;FONT face="Calibri" size="3"&gt;234&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P align="right"&gt;&lt;FONT face="Calibri" size="3"&gt;2019-09-24&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;"A&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;BBBBBBBBBB&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P align="left"&gt;&lt;FONT face="Calibri" size="3"&gt;CCCCCCCCCC&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 11 Jul 2017 06:02:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374798#M89781</guid>
      <dc:creator>hinear</dc:creator>
      <dc:date>2017-07-11T06:02:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374861#M89805</link>
      <description>&lt;P&gt;Sorry, I tried it, but it doesn't work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: The INFILE statement MISSOVER option and the INPUT statement double trailing @ option, are being used in an inconsistent&lt;/P&gt;&lt;P&gt;manner. The execution of the DATA STEP is being terminated to prevent an infinite loop condition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if I take out @@, the output is the same&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 10:05:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374861#M89805</guid>
      <dc:creator>hinear</dc:creator>
      <dc:date>2017-07-11T10:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374894#M89808</link>
      <description>&lt;P&gt;Remove &lt;FONT size="3" color="#0000ff" face="Courier New"&gt;MISSOVER&lt;/FONT&gt;&amp;nbsp; ,they are conflicted .&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 11:44:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374894#M89808</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-07-11T11:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374956#M89829</link>
      <description>&lt;P&gt;You will first need to pre-process the file to remove the embedded CRLF characters.&lt;/P&gt;
&lt;P&gt;The simple quote counting technique that&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;posted on this thread should do the trick for this file since the strings with the embedded CRLF are quoted.&lt;/P&gt;
&lt;P&gt;Then you can read the fixed file using normal delimited file input syntax.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 13:48:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/374956#M89829</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-07-11T13:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/376880#M90494</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I finally contact sas support and they give a similar solution.&lt;/P&gt;&lt;P&gt;the method is replace the carriage return and linefeed characters inside the double quotation mark by '@' and '$'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/26/065.html" target="_blank"&gt;http://support.sas.com/kb/26/065.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for all of your help.&amp;nbsp;Otherwise, I don't even notice that there are &amp;lt;CR&amp;gt;&amp;lt;LF&amp;gt; inside the file.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 07:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/376880#M90494</guid>
      <dc:creator>hinear</dc:creator>
      <dc:date>2017-07-18T07:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a .d file with long character across multiple line?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/376888#M90495</link>
      <description>&lt;P&gt;Which, you will see from my post above had already been supplied by support and posted above.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 07:59:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-a-d-file-with-long-character-across-multiple-line/m-p/376888#M90495</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-18T07:59:29Z</dc:date>
    </item>
  </channel>
</rss>

