<?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: Scan a string to find word after a specific word in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684688#M207529</link>
    <description>&lt;P&gt;hey. yes we thought so, hence, for now dropping that idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One last thing here.. can i get the output in below manner:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output: dot.like lib.tab, lib1.tab1&lt;/P&gt;</description>
    <pubDate>Thu, 17 Sep 2020 16:19:13 GMT</pubDate>
    <dc:creator>upadhi</dc:creator>
    <dc:date>2020-09-17T16:19:13Z</dc:date>
    <item>
      <title>Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684517#M207439</link>
      <description>&lt;P&gt;string: my aim is to find every word after BANK.upa for every bank.xx in this line bank.ff&lt;/P&gt;
&lt;P&gt;output: upa xx ff&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can i achieve the same&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 08:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684517#M207439</guid>
      <dc:creator>upadhi</dc:creator>
      <dc:date>2020-09-17T08:30:19Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684526#M207445</link>
      <description>&lt;P&gt;Mayby with: findw, substr + scan?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  start = 1;
  word = "bank";
  string = "my aim is to find every word after BANK.upa for every bank.xx in this line bank.ff";
  length tmp $ 20 output $ 200;

  do until (pos = 0);
    pos = findw(string, word, ,"SPI", start);
    if pos = 0 then leave;
    tmp = scan(substr(string, pos), 2, ,"SPI");
    start = pos + 1;
    output = catx(" ", output, tmp);
  end;

  put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 09:30:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684526#M207445</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-09-17T09:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684550#M207468</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
 string = "my aim is to find every word after bank_beg.upa for every bank_beg.xx in this line bank_beg.ff";
 length want $ 80;
pid=prxparse('/(?&amp;lt;=bank_beg\.)\w+/i'); 
 s=1;e=length(string);
 call prxnext(pid,s,e,string,p,l);
 do while(p&amp;gt;0);
   want=catx(' ',want,substr(string,p,l));
    call prxnext(pid,s,e,string,p,l);
 end;
 drop s e p l pid;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Sep 2020 11:59:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684550#M207468</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-09-17T11:59:42Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684554#M207470</link>
      <description>&lt;P&gt;hello Bart,&lt;/P&gt;
&lt;P&gt;The code works as expected. However, next challenge i faced was, the word i was searching for has an "_"&lt;/P&gt;
&lt;P&gt;Example: word="bank_beg"&lt;/P&gt;
&lt;P&gt;string: "&lt;SPAN&gt;my aim is to find every word after bank_beg.upa for every bank_beg.xx in this line bank_beg.ff&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The output i get is beg&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 11:42:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684554#M207470</guid>
      <dc:creator>upadhi</dc:creator>
      <dc:date>2020-09-17T11:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684557#M207472</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  start = 1;
  word = "bank_beg";
  string = "my aim is to find every word after bank_beg.upa for every bank_beg.xx in this line bank_beg.ff";
  length tmp $ 20 output $ 200;

  do until (pos = 0);
    pos = findw(string, word, ".","SI", start);
    if pos = 0 then leave;
    tmp = scan(substr(string, pos), 2, ".","SI");
    start = pos + 1;
    output = catx(" ", output, tmp);
  end;

  put _all_;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Sep 2020 11:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684557#M207472</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-09-17T11:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684580#M207479</link>
      <description>&lt;P&gt;Thank you so much for your help. apologies if i am asking too much. but i also need to find out if table we detected was input/output. for example:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="upadhi_0-1600347305518.png" style="width: 639px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49490i4D5CB0C1127CF3D3/image-dimensions/639x213?v=v2" width="639" height="213" role="button" title="upadhi_0-1600347305518.png" alt="upadhi_0-1600347305518.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;here for row 1, UPA11 is output table. for row-7, FSK_HEADER is an input table. , row-8, FSK_Scenario is input table and so on&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is there a possible solution to find this out&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 12:56:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684580#M207479</guid>
      <dc:creator>upadhi</dc:creator>
      <dc:date>2020-09-17T12:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684593#M207485</link>
      <description>That is very complicated . You need define many rules .&lt;BR /&gt;i.e.  out=xxx  is output table ,change prx as &lt;BR /&gt;pid=prxparse('/(?&amp;lt;=out\=bank_beg\.)\w+/i');&lt;BR /&gt;&lt;BR /&gt;set xxx; is input table, change prx as&lt;BR /&gt;pid=prxparse('/(?&amp;lt;=\bset bank_beg\.)\w+/i');</description>
      <pubDate>Thu, 17 Sep 2020 13:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684593#M207485</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-09-17T13:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684688#M207529</link>
      <description>&lt;P&gt;hey. yes we thought so, hence, for now dropping that idea.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One last thing here.. can i get the output in below manner:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output: dot.like lib.tab, lib1.tab1&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 16:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684688#M207529</guid>
      <dc:creator>upadhi</dc:creator>
      <dc:date>2020-09-17T16:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684768#M207569</link>
      <description>&lt;P&gt;Look into Proc SCAPROC.&lt;/P&gt;
&lt;P&gt;It can direct job related information to a text file you specify that has the specific types of information you are looking for.&lt;/P&gt;
&lt;P&gt;Some example output copied from the example in the documentation:&lt;/P&gt;
&lt;PRE&gt;/* JOBSPLIT: ITEMSTOR INPUT SASUSER.TEMPLAT */
/* JOBSPLIT: ITEMSTOR INPUT SASHELP.TMPLMST */
/* JOBSPLIT: DATASET INPUT SEQ WORK.A.DATA */
/* JOBSPLIT: LIBNAME WORK ENGINE V9 PHYS C:\DOCUME~1\userid\LOCALS~1\Temp\SAS
Temporary Files\_TD1252 */
/* JOBSPLIT: ELAPSED 5187  */
/* JOBSPLIT: PROCNAME PRINT */
/* JOBSPLIT: STEP SOURCE FOLLOWS */
proc print data=a(obs=25);
run;


/* JOBSPLIT: DATASET INPUT SEQ WORK.A.DATA */
/* JOBSPLIT: LIBNAME WORK ENGINE V9 PHYS C:\DOCUME~1\userid\LOCALS~1\Temp\SAS
Temporary Files\_TD1252 */
/* JOBSPLIT: FILE OUTPUT C:\winnt\profiles\userid\record.txt */
/* JOBSPLIT: SYMBOL GET SYSSUMTRACE */
/* JOBSPLIT: ELAPSED 2750  */
/* JOBSPLIT: PROCNAME MEANS */
/* JOBSPLIT: STEP SOURCE FOLLOWS */
proc means data=a;
run;
&lt;/PRE&gt;
&lt;P&gt;The output before the code indicates input data sets such as&lt;/P&gt;
&lt;P&gt;/* JOBSPLIT: DATASET INPUT SEQ WORK.A.DATA */&lt;/P&gt;
&lt;P&gt;So you can parse the file and know that Work.A was the data set used for input to the Proc print AND file location of the library. Which is import for libraries whose names get reused with different locations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have data cleaning projects that are done monthly. The library changes to reflect the data. The code doesn't other than one setup programming establishing the paths and library. So even having a library name does not tell the actual location just from code.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2020 19:23:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/684768#M207569</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-09-17T19:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/685180#M207773</link>
      <description>&lt;P&gt;Sure.&lt;/P&gt;
&lt;PRE&gt;data want;
 string = " find all words before and after dot.like this; select lib.tab , lib1.tab1;";
 length want $ 80;
pid=prxparse('/\w+\.\w+/'); 
 s=1;e=length(string);
 call prxnext(pid,s,e,string,p,l);
 do while(p&amp;gt;0);
   want=catx(' ',want,substr(string,p,l));
    call prxnext(pid,s,e,string,p,l);
 end;
 drop s e p l pid;
run;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Sep 2020 11:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/685180#M207773</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-09-19T11:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/685322#M207841</link>
      <description>&lt;P&gt;hello, The code is working as expected. However i have some exceptions. eg. reading _ and &amp;amp; as part of want.&lt;/P&gt;
&lt;P&gt;example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt; string = "my aim is to find every word after bank_beg.upa_&amp;amp;kok for every bank_beg.&amp;amp;Kok in this line bank_beg.upa_&amp;amp;dd._kok(keep=x)";
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;want= upa_&amp;amp;kok %kok upa_&amp;amp;dd._kok&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically the delimiters is limite to " ;)" rest all character should be read as part of want.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2020 07:56:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/685322#M207841</guid>
      <dc:creator>upadhi</dc:creator>
      <dc:date>2020-09-21T07:56:09Z</dc:date>
    </item>
    <item>
      <title>Re: Scan a string to find word after a specific word</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/685359#M207851</link>
      <description>&lt;PRE&gt;OK. Try this one .

pid=prxparse('/\.[^ ;()]+/'); 
&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Sep 2020 10:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Scan-a-string-to-find-word-after-a-specific-word/m-p/685359#M207851</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2020-09-21T10:30:34Z</dc:date>
    </item>
  </channel>
</rss>

