<?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 scan function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/495664#M130860</link>
    <description>&lt;P&gt;Can we use string as delimiter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;like . scan(word,"AND",1);&lt;/P&gt;</description>
    <pubDate>Fri, 14 Sep 2018 13:14:48 GMT</pubDate>
    <dc:creator>Aman4SAS</dc:creator>
    <dc:date>2018-09-14T13:14:48Z</dc:date>
    <item>
      <title>scan function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/495664#M130860</link>
      <description>&lt;P&gt;Can we use string as delimiter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;like . scan(word,"AND",1);&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/495664#M130860</guid>
      <dc:creator>Aman4SAS</dc:creator>
      <dc:date>2018-09-14T13:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: scan function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/495669#M130864</link>
      <description>&lt;P&gt;Have you read the manual:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214639.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000214639.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Particularly:&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="strong"&gt;&lt;SPAN class="strongEmph"&gt;charlist&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;specifies an optional character expression that initializes a list of characters. This list determines which characters are used as the delimiters that separate words. The following rules apply:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;P&gt;By default, all characters in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="strongEmph"&gt;charlist&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;are used as delimiters.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;If you specify the K modifier in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="strongEmph"&gt;modifier&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;argument, then all characters that are&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="strongEmph"&gt;not&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="strongEmph"&gt;charlist&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;are used as delimiters.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;TABLE cellspacing="2" cellpadding="4"&gt;
&lt;TBODY&gt;
&lt;TR valign="top"&gt;
&lt;TD width="95" align="left" class="label"&gt;Tip:&lt;/TD&gt;
&lt;TD align="left" class="bgBlockLight"&gt;You can add more characters to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="strongEmph"&gt;charlist&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;by using other modifiers.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The string you provide is not used "as is", any place where A, N, or D is found is a delimiter.&amp;nbsp; Use substr() and findw()&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 13:25:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/495669#M130864</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-09-14T13:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: scan function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/495714#M130893</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/39317"&gt;@Aman4SAS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can we use string as delimiter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;like . scan(word,"AND",1);&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;See it this gives you enough to get started.&lt;/P&gt;
&lt;PRE&gt;data example;
   x="This is a phrase with the word and embedded";
  newx = tranwrd(x,' and ','+');
  y=scan(newx,1,'+');
run;&lt;/PRE&gt;
&lt;P&gt;The spaces around the ' and ' are there to get and as word so it does not get replaced inside words like "sand".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use a character such as the + that 1) will not appear in your data and 2) is not a normal delimiter for the scan function so you get breaks where you expect it.&lt;/P&gt;
&lt;P&gt;TRANWRD function is case sensitive. You may need either multiple passes through TRANWRD if you need " And " as well as " and " " AND " and so forth. Or UPCASE or&amp;nbsp;LOWCASE&amp;nbsp;the whole string.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 14:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/scan-function/m-p/495714#M130893</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-14T14:55:23Z</dc:date>
    </item>
  </channel>
</rss>

