<?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: extract value after a set number of specific symbols sas in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803552#M81680</link>
    <description>&lt;P&gt;Wouldn't just "backward" scan() be good?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  want = scan(params,-12,"|","M");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
    <pubDate>Wed, 23 Mar 2022 12:46:56 GMT</pubDate>
    <dc:creator>yabwon</dc:creator>
    <dc:date>2022-03-23T12:46:56Z</dc:date>
    <item>
      <title>extract value after a set number of specific symbols sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803539#M81678</link>
      <description>&lt;P&gt;Hey,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to see if there is a specific value (in this case the letter "Y") after a set number of specific symbols (in this case in between the last 11 and 12 "|"s).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to save the value in a new column and then doing an if statement, but the issue is that I do not know how to print the letter just before the last 11 |'s.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;PRE&gt;data have;
input params $70.;
cards;
|bla|||||5||bla|bla||||||bla||||bla|||||||Y|||||||||||
|bla|||||10||bla|bla||||||bla||||bla|||||||Y|baa||||||||||
|bla|||||10||bla|bla||||||bla||||bla||||||||baa||||||||||
;

data want;
set have;
Want = substr(params, length(params)-11,1);
run;&lt;/PRE&gt;&lt;P&gt;In this example i wanted it to print:&lt;/P&gt;&lt;P&gt;1: Y&lt;/P&gt;&lt;P&gt;2: Y&lt;/P&gt;&lt;P&gt;3: nothing&lt;/P&gt;&lt;P&gt;and not&lt;/P&gt;&lt;P&gt;1: Y&lt;/P&gt;&lt;P&gt;2: a&lt;/P&gt;&lt;P&gt;3: a&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 11:44:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803539#M81678</guid>
      <dc:creator>Louis_DB</dc:creator>
      <dc:date>2022-03-23T11:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: extract value after a set number of specific symbols sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803542#M81679</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input params $70.;
cards;
|bla|||||5||bla|bla||||||bla||||bla|||||||Y|||||||||||
|bla|||||10||bla|bla||||||bla||||bla|||||||Y|baa||||||||||
|bla|||||10||bla|bla||||||bla||||bla||||||||baa||||||||||
;

data want;
set have;
call scan(params,-12,p,l,'|','mq');
want=substrn(params,p,l);
drop p l;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Mar 2022 12:18:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803542#M81679</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-03-23T12:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: extract value after a set number of specific symbols sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803552#M81680</link>
      <description>&lt;P&gt;Wouldn't just "backward" scan() be good?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  want = scan(params,-12,"|","M");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 12:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803552#M81680</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2022-03-23T12:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: extract value after a set number of specific symbols sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803554#M81681</link>
      <description>Sure. In this case, both are same . But yours could save one line code .</description>
      <pubDate>Wed, 23 Mar 2022 12:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803554#M81681</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-03-23T12:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: extract value after a set number of specific symbols sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803562#M81682</link>
      <description>&lt;P&gt;SCAN() is better in this case since the request was just for the value between the delimiters, not the rest of the string.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2022 13:26:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803562#M81682</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-03-23T13:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: extract value after a set number of specific symbols sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803768#M81683</link>
      <description>Tom,&lt;BR /&gt;SCAN() and CALL SCAN() are the same function and rountine .&lt;BR /&gt;This could save one line code, if it was what you are thinking , Whatever .</description>
      <pubDate>Thu, 24 Mar 2022 11:35:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/extract-value-after-a-set-number-of-specific-symbols-sas/m-p/803768#M81683</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-03-24T11:35:39Z</dc:date>
    </item>
  </channel>
</rss>

