<?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: single quotation between two delimetere causing issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/369979#M88368</link>
    <description>&lt;P&gt;The behavior you are observing is the purpose of the DSD option as documented. When I removed the DSD option the data read as intended.&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jun 2017 16:09:50 GMT</pubDate>
    <dc:creator>RickAster</dc:creator>
    <dc:date>2017-06-23T16:09:50Z</dc:date>
    <item>
      <title>single quotation between two delimetere causing issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/369944#M88362</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having two single quote (') seprated by delimeter.&lt;/P&gt;&lt;P&gt;its is reading them as 1 and var3 is equal to "8" which should be var4 in second observation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data ds1;&lt;BR /&gt;infile datalines dsd dlm='|';&lt;BR /&gt;input var1-var4;&lt;BR /&gt;datalines;&lt;BR /&gt;1|2|3|4|&lt;BR /&gt;9|'|'|8|&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc print data=ds1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I don't want to "~" before variable because in actual case I don't which two consuctive variable will contain single quotation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actual text which I'm trying to import from unix contains 200 variable and that is tab delimited.. I've given above example of pipe delimited just to more readable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me out !!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Atul Deshmukh&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 15:28:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/369944#M88362</guid>
      <dc:creator>atul_desh</dc:creator>
      <dc:date>2017-06-23T15:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: single quotation between two delimetere causing issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/369979#M88368</link>
      <description>&lt;P&gt;The behavior you are observing is the purpose of the DSD option as documented. When I removed the DSD option the data read as intended.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 16:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/369979#M88368</guid>
      <dc:creator>RickAster</dc:creator>
      <dc:date>2017-06-23T16:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: single quotation between two delimetere causing issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/370012#M88373</link>
      <description>&lt;P&gt;So if your input file never has null values then you can just drop the DSD option.&lt;/P&gt;
&lt;P&gt;But if your input file has both null values (ie examples where two delimiters are right next to each other and it means there is value that empty) then you will need to process the data line before reading it.&lt;/P&gt;
&lt;P&gt;So you could change the |'| into |"'"| so that SAS will see that the single quote is in fact a quoted string and so the DSD option will work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input @;
do while (index(_infile_,"|'|"));
  _infile_=tranwrd(_infile_,"|'|","|""'""|");
end;
input var1-var5;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or if you never have actual quoted string values that would also require the DSD option then perhaps you can drop the DSD option from the INFILE and instead convert the || into |.| to indicate a missing value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input @;
do while (index(_infile_,"||"));
  _infile_=tranwrd(_infile_,"||","|.|");
end;
input var1-var5;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Jun 2017 16:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/370012#M88373</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-23T16:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: single quotation between two delimetere causing issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/370152#M88405</link>
      <description>But my actual file is not pipe delimited it is tab delimeted... Here I've given example of pipe delimited just to get more understand.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 23 Jun 2017 20:15:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/370152#M88405</guid>
      <dc:creator>atul_desh</dc:creator>
      <dc:date>2017-06-23T20:15:54Z</dc:date>
    </item>
    <item>
      <title>Re: single quotation between two delimetere causing issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/370157#M88409</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/94664"&gt;@atul_desh&lt;/a&gt; wrote:&lt;BR /&gt;But my actual file is not pipe delimited it is tab delimeted... Here I've given example of pipe delimited just to get more understand.&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So in the fix use tabs instead of pipe character. &amp;nbsp;The hex code for a tab is '09'x.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jun 2017 20:32:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/single-quotation-between-two-delimetere-causing-issue/m-p/370157#M88409</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-23T20:32:57Z</dc:date>
    </item>
  </channel>
</rss>

