<?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: Importing delimited file with text qualifiers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/448985#M112949</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/201377"&gt;@Konakanchi&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;am trying to read in a pipe delimited file through SAS.&amp;nbsp;There are consecutive apostrophes in data. So my data looks like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A|B|'|'|||X|G&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While reading in, I used DSD in INFILE. However, the delimted enclosed in ' is considered as data and placed in the SAS data set. This pis prompting data shift and the readin is messed. Is there a way to explicitly define text qualifier in SAS? Or any alternate solution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would be very tempted to contact whoever made that file to find out what a field with a single quote is supposed to actually mean. A single row is hard to diagnose data file issues but perhaps the quotes are there because the originator intended the third variable to actually contain a pipe symbol. How many pipe symbols appear on other rows of data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW you do not have consecutive apostrophes in data. That would look like A|B|''|||X|G and would make some sense.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Mar 2018 14:25:48 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-03-27T14:25:48Z</dc:date>
    <item>
      <title>Importing delimited file with text qualifiers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/448928#M112933</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;am trying to read in a pipe delimited file through SAS.&amp;nbsp;There are consecutive apostrophes in data. So my data looks like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A|B|'|'|||X|G&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While reading in, I used DSD in INFILE. However, the delimted enclosed in ' is considered as data and placed in the SAS data set. This pis prompting data shift and the readin is messed. Is there a way to explicitly define text qualifier in SAS? Or any alternate solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 11:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/448928#M112933</guid>
      <dc:creator>Konakanchi</dc:creator>
      <dc:date>2018-03-27T11:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: Importing delimited file with text qualifiers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/448948#M112941</link>
      <description>&lt;P&gt;How about get rid of these single quote firstly ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover dsd dlm='|';
input @;
_infile_=compress(_infile_,"'");
input (v1-v8) (: $40.);
cards;
A|B|'|'|||X|G
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Mar 2018 12:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/448948#M112941</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-03-27T12:20:55Z</dc:date>
    </item>
    <item>
      <title>Re: Importing delimited file with text qualifiers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/448985#M112949</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/201377"&gt;@Konakanchi&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I&amp;nbsp;am trying to read in a pipe delimited file through SAS.&amp;nbsp;There are consecutive apostrophes in data. So my data looks like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A|B|'|'|||X|G&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While reading in, I used DSD in INFILE. However, the delimted enclosed in ' is considered as data and placed in the SAS data set. This pis prompting data shift and the readin is messed. Is there a way to explicitly define text qualifier in SAS? Or any alternate solution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would be very tempted to contact whoever made that file to find out what a field with a single quote is supposed to actually mean. A single row is hard to diagnose data file issues but perhaps the quotes are there because the originator intended the third variable to actually contain a pipe symbol. How many pipe symbols appear on other rows of data?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW you do not have consecutive apostrophes in data. That would look like A|B|''|||X|G and would make some sense.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 14:25:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/448985#M112949</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-27T14:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Importing delimited file with text qualifiers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/449215#M113034</link>
      <description>&lt;P&gt;Normally I would suggest that you ask the person sending you the file to fix it, but it looks like you have found a bug in how SAS generates delimited files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename test temp;
data _null_;
  length x1-x8 $8 ;
  file test dsd dlm='|';
  x1='A';  x2='B';  x3="'";  x4="'";
  x5=' ';  x6=' ';  x7='X';  x8='G';
  put (x1-x8) (+0) ;
  putlog (x1-x8) (=);
run;

data _null_;
  infile test dsd dlm='|' truncover;
  input (x1-x8) ($) ;
  put (x1-x8) (=);
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;x1=A x2=B x3=| x4=  x5=  x6=X x7=G x8=
RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
1         A|B|'|'|||X|G 13
NOTE: 1 record was read from the infile TEST.
&lt;/PRE&gt;
&lt;P&gt;You can scan that line if you use the 'm' modifier without the 'q' modifier.&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;  array y (8) $ ;
  do i=1 to dim(y) ;
    y(i) = scan(_infile_,i,'|','m');
  end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are generating the file using SAS you could add the ~ modifier to force SAS to write quotes around all of the values.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  length x1-x8 $8 ;
  file test dsd dlm='|';
  x1='A';  x2='B';  x3="'";  x4="'";
  x5=' ';  x6=' ';  x7='X';  x8='G';
  put (x1-x8) (~) ;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;"A"|"B"|"'"|"'"|" "|" "|"X"|"G"&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;</description>
      <pubDate>Wed, 28 Mar 2018 04:20:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/449215#M113034</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-03-28T04:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Importing delimited file with text qualifiers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/449246#M113041</link>
      <description>&lt;P&gt;Tried scanning without m identifier earlier. Data shift was observed. When m identifier is used, the issue is resolved. Data is populating correctly without any readin issue by populating blanks in fields wherever it is ' alone. Thank You.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 09:12:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-delimited-file-with-text-qualifiers/m-p/449246#M113041</guid>
      <dc:creator>Konakanchi</dc:creator>
      <dc:date>2018-03-28T09:12:28Z</dc:date>
    </item>
  </channel>
</rss>

