<?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: How to extract characters from a string staring from right hand side? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399659#M96819</link>
    <description>&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;extract= substr(x, length(x)-&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;24&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;+&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;I did 24 + 1 incase you need to change the 24 based on a variable value.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;If you have 10 characters and want 4, 10-4=6, but character positions&amp;nbsp;6,7,8,9 and 10 = 5 characters, so add 1.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;This will not work if you ask for more characters than exist though.&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Sep 2017 23:03:55 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-09-28T23:03:55Z</dc:date>
    <item>
      <title>How to extract characters from a string staring from right hand side?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399655#M96817</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I have a string variable called part4 that looks something like:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="part4.PNG" style="width: 287px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15489iB1F3B83116C56C39/image-size/large?v=v2&amp;amp;px=999" role="button" title="part4.PNG" alt="part4.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to extract the first 24&amp;nbsp;characters starting from right hand side moving toward the left, how can I accomplish that?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 21:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399655#M96817</guid>
      <dc:creator>nismail1976</dc:creator>
      <dc:date>2017-09-28T21:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract characters from a string staring from right hand side?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399657#M96818</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
EXTRACT=substr(reverse(trim(PART4)),1,24);&amp;nbsp;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 23:01:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399657#M96818</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-09-28T23:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract characters from a string staring from right hand side?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399659#M96819</link>
      <description>&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;extract= substr(x, length(x)-&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;24&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;+&lt;/FONT&gt;&lt;FONT color="#008080" face="SAS Monospace" size="2"&gt;1&lt;/FONT&gt;&lt;FONT face="SAS Monospace" size="2"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;I did 24 + 1 incase you need to change the 24 based on a variable value.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;If you have 10 characters and want 4, 10-4=6, but character positions&amp;nbsp;6,7,8,9 and 10 = 5 characters, so add 1.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="2"&gt;This will not work if you ask for more characters than exist though.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2017 23:03:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399659#M96819</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-09-28T23:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract characters from a string staring from right hand side?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399670#M96825</link>
      <description>&lt;P&gt;Try this....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
Latest24months = ifc(length(text)&amp;gt;24,substrn(text,length(text)-23), text);

LATETS24MONTHS_2= ifc(length(text)&amp;lt;=24,TEXT, substrn(text,length(text)-23));&lt;BR /&gt;&lt;BR /&gt;IF LATEST24MONTHS = LATEST24MONTHS_2 THEN TAG=1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Choose between latest24months or latest24months_2.&amp;nbsp; Tag is used to check if both will provide the same result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 01:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399670#M96825</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2017-09-29T01:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract characters from a string staring from right hand side?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399692#M96829</link>
      <description>&lt;P&gt;I think this will always work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;extract= right(subpad(x, max(1, length(x)-24+1), 24));&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 03:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-extract-characters-from-a-string-staring-from-right-hand/m-p/399692#M96829</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-09-29T03:51:20Z</dc:date>
    </item>
  </channel>
</rss>

