<?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 first word from left and right after a specific character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Scan-first-word-from-left-and-right-after-a-specific-character/m-p/684702#M207535</link>
    <description>&lt;P&gt;hi team,&lt;/P&gt;
&lt;P&gt;i want to extract single word coming before and after dot(.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example:&lt;/P&gt;
&lt;P&gt;string : find all words before and after dot.like this; select lib.tab , lib1.tab1;&lt;/P&gt;
&lt;P&gt;Output: dot.like lib.tab, lib1.tab1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The idea is to extract lib_name.table_name from sas code line&lt;/P&gt;</description>
    <pubDate>Thu, 17 Sep 2020 16:42:20 GMT</pubDate>
    <dc:creator>upadhi</dc:creator>
    <dc:date>2020-09-17T16:42:20Z</dc:date>
    <item>
      <title>Scan first word from left and right after a specific character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-first-word-from-left-and-right-after-a-specific-character/m-p/684702#M207535</link>
      <description>&lt;P&gt;hi team,&lt;/P&gt;
&lt;P&gt;i want to extract single word coming before and after dot(.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example:&lt;/P&gt;
&lt;P&gt;string : find all words before and after dot.like this; select lib.tab , lib1.tab1;&lt;/P&gt;
&lt;P&gt;Output: dot.like lib.tab, lib1.tab1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The idea is to extract lib_name.table_name from sas code line&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 16:42:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-first-word-from-left-and-right-after-a-specific-character/m-p/684702#M207535</guid>
      <dc:creator>upadhi</dc:creator>
      <dc:date>2020-09-17T16:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Scan first word from left and right after a specific character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-first-word-from-left-and-right-after-a-specific-character/m-p/684717#M207545</link>
      <description>&lt;P&gt;I would find the position of the dot (period) using the Index function and then scan left or right from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 17:36:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-first-word-from-left-and-right-after-a-specific-character/m-p/684717#M207545</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-17T17:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: Scan first word from left and right after a specific character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-first-word-from-left-and-right-after-a-specific-character/m-p/684728#M207552</link>
      <description>&lt;P&gt;Here's some sample code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET	String		=	I love apple.pie and ice cream;

%LET	Position	=	%SYSFUNC(INDEXC(&amp;amp;String,.));
%LET	Word_Before	=	%SYSFUNC(SCAN(%QSUBSTR(&amp;amp;String, 1, %EVAL(&amp;amp;Position - 1)), -1));
%LET	Word_After	=	%SYSFUNC(SCAN(%QSUBSTR(&amp;amp;String, %EVAL(&amp;amp;Position + 1)), 1));

OPTION	NOSOURCE;
%PUT	NOTE:  &amp;amp;=Position;
%PUT	NOTE-  &amp;amp;=Word_Before;
%PUT	NOTE-  &amp;amp;=Word_After;
OPTION	SOURCE;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;NOTE:  POSITION=13
       WORD_BEFORE=apple
       WORD_AFTER=pie
&lt;/PRE&gt;
&lt;P&gt;Note that this code may not give you the results you want if there are multiple periods in one text string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 17:53:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-first-word-from-left-and-right-after-a-specific-character/m-p/684728#M207552</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2020-09-17T17:53:48Z</dc:date>
    </item>
  </channel>
</rss>

