<?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: substr function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889603#M351496</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Yes I did,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if sub = "(112)1245674"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I expect code1= substr(sub, 2, 4); to extract 112.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The first "(" is 1 the from there 2,4 should be 112.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I'm not why it is generating 112).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Aug 2023 08:40:26 GMT</pubDate>
    <dc:creator>PrinceAde</dc:creator>
    <dc:date>2023-08-17T08:40:26Z</dc:date>
    <item>
      <title>substr function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889597#M351494</link>
      <description>&lt;P&gt;Hi everyone, please I need clarification with how Substr functions works&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if sub = "(112)1245674" then do;&lt;BR /&gt;code1= substr(sub, 2, 4);&lt;BR /&gt;code2 = substr(sub, 6);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;I expect code1 variable to be 112, but it gave me 112);&lt;/P&gt;&lt;P&gt;while&amp;nbsp;code1= substr(sub, 2, 3); gave 112.&lt;/P&gt;&lt;P&gt;any explanation as to why?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 08:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889597#M351494</guid>
      <dc:creator>PrinceAde</dc:creator>
      <dc:date>2023-08-17T08:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: substr function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889600#M351495</link>
      <description>&lt;P&gt;It always a good idea to have a look at the documentation when in doubt about the parameters of a function. The third argument of substr is the number of chars to extract.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 08:29:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889600#M351495</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-08-17T08:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: substr function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889603#M351496</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Yes I did,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if sub = "(112)1245674"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I expect code1= substr(sub, 2, 4); to extract 112.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The first "(" is 1 the from there 2,4 should be 112.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I'm not why it is generating 112).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 08:40:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889603#M351496</guid>
      <dc:creator>PrinceAde</dc:creator>
      <dc:date>2023-08-17T08:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: substr function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889606#M351498</link>
      <description>&lt;P&gt;Why do you expect to get&amp;nbsp;&lt;STRONG&gt;3&lt;/STRONG&gt; characters when you tell the function to extract&amp;nbsp;&lt;STRONG&gt;4&lt;/STRONG&gt; characters?&lt;/P&gt;
&lt;P&gt;Note that the second parameter is not a&amp;nbsp;&lt;EM&gt;position&lt;/EM&gt;, it is a&amp;nbsp;&lt;EM&gt;length&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 09:13:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889606#M351498</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-08-17T09:13:21Z</dc:date>
    </item>
    <item>
      <title>Re: substr function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889608#M351500</link>
      <description>&lt;P&gt;Oh. Now clear. I forgot the third argument is the no character specified in length.&lt;/P&gt;&lt;P&gt;Thanks a lot;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 09:18:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/substr-function/m-p/889608#M351500</guid>
      <dc:creator>PrinceAde</dc:creator>
      <dc:date>2023-08-17T09:18:25Z</dc:date>
    </item>
  </channel>
</rss>

