<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802476#M315919</link>
    <description>&lt;P&gt;Your task can be much easier solved by using the right tool (Maxim 14), which is the SCAN function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input string $7.;
last_word = scan(string,-1,"., ");
cards;
ABC.DEF
JHG GHTY
HYT,XYZ
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 16 Mar 2022 12:31:39 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-03-16T12:31:39Z</dc:date>
    <item>
      <title>Substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802425#M315890</link>
      <description>I am not understanding below program how it resolved&lt;BR /&gt;Data a;&lt;BR /&gt;Input string 7.;&lt;BR /&gt;Reverse=reverse (string);&lt;BR /&gt;pos=indexc(reverse,"., ");&lt;BR /&gt;Last_word=substr (string,7-pos+2);&lt;BR /&gt;Cards;&lt;BR /&gt;ABC.DEF&lt;BR /&gt;JHG GHTY&lt;BR /&gt;HYT,XYZ&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;BR /&gt;HERE LAST_WORD STATEMENT HOW IT WILL RESOLVE, PLEASE EXPLAIN</description>
      <pubDate>Wed, 16 Mar 2022 06:51:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802425#M315890</guid>
      <dc:creator>PurushReddy</dc:creator>
      <dc:date>2022-03-16T06:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: Substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802429#M315893</link>
      <description>&lt;P&gt;Insert a put _all_; statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run the program.&lt;/P&gt;
&lt;P&gt;Examine log.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 07:29:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802429#M315893</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-03-16T07:29:31Z</dc:date>
    </item>
    <item>
      <title>Re: Substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802446#M315900</link>
      <description>&lt;P&gt;I think you want to declare String to be a CHARACTER variable. Currently, it is a numeric variable. To declare a character variable, put a '$' symbol after the name of the variable on the INPUT statement, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Input string $ 7.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;After making that change, rerun the program and examine the output. Let us know if you still have questions!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 10:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802446#M315900</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-03-16T10:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802448#M315902</link>
      <description>Thanks for your response,&lt;BR /&gt;I want to know how this is working,means flow&lt;BR /&gt;Last _word=Substr(string,7-pos+2);</description>
      <pubDate>Wed, 16 Mar 2022 10:29:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802448#M315902</guid>
      <dc:creator>PurushReddy</dc:creator>
      <dc:date>2022-03-16T10:29:59Z</dc:date>
    </item>
    <item>
      <title>Last _word=Substr(string,7-p+2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802449#M315911</link>
      <description>flow of work&lt;BR /&gt;Last _word=Substr(string,7-pos+2);&lt;BR /&gt;*7-pos+2(here pos value:4)*</description>
      <pubDate>Wed, 16 Mar 2022 10:41:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802449#M315911</guid>
      <dc:creator>PurushReddy</dc:creator>
      <dc:date>2022-03-16T10:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: Substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802456#M315905</link>
      <description>&lt;P&gt;The doc is your friend. Here is &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.2/lefunctionsref/n0n08xougp40i5n1xw7njpcy0a2b.htm" target="_self"&gt;a link to the SUBSTR doc.&lt;/A&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;pos = the location of a delimiter in the reverse string. The delimiters are '.' or ',' or ' '.&lt;/LI&gt;
&lt;LI&gt;Each string in your data is 7 characters long, so 7-pos gives the position of the character BEFORE the delimiter.&lt;/LI&gt;
&lt;LI&gt;Therefore 7-pos+2 gives the position of the character AFTER the delimiter.&lt;/LI&gt;
&lt;LI&gt;The SUBSTR function copies all characters from that position until the end of the string.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 10:54:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802456#M315905</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2022-03-16T10:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Last _word=Substr(string,7-p+2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802460#M315912</link>
      <description>&lt;P&gt;What determines `pos`? Please provide some example data.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 11:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802460#M315912</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2022-03-16T11:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Last _word=Substr(string,7-p+2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802461#M315913</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321287"&gt;@PurushReddy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;flow of work&lt;BR /&gt;Last _word=Substr(string,7-pos+2);&lt;BR /&gt;*7-pos+2(here pos value:4)*&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is your question?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 11:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802461#M315913</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-03-16T11:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Last _word=Substr(string,7-p+2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802470#M315914</link>
      <description>&lt;P&gt;I moved your erroneous post in here.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 12:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802470#M315914</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-16T12:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Last _word=Substr(string,7-p+2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802471#M315915</link>
      <description>Substr(string,7-pos+2),&lt;BR /&gt;How this is working, I am not getting, what is the flow of.</description>
      <pubDate>Wed, 16 Mar 2022 12:16:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802471#M315915</guid>
      <dc:creator>PurushReddy</dc:creator>
      <dc:date>2022-03-16T12:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Last _word=Substr(string,7-p+2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802473#M315916</link>
      <description>Actually this is total dataset, I want to know how(Last_word=substr (string,7-pos+2);).&lt;BR /&gt;&lt;BR /&gt;Data a;&lt;BR /&gt;Input string 7.;&lt;BR /&gt;Reverse=reverse (string);&lt;BR /&gt;pos=indexc(reverse,"., ");&lt;BR /&gt;Last_word=substr (string,7-pos+2);&lt;BR /&gt;Cards;&lt;BR /&gt;ABC.DEF&lt;BR /&gt;JHG GHTY&lt;BR /&gt;HYT,XYZ&lt;BR /&gt;;&lt;BR /&gt;RUN;</description>
      <pubDate>Wed, 16 Mar 2022 12:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802473#M315916</guid>
      <dc:creator>PurushReddy</dc:creator>
      <dc:date>2022-03-16T12:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Last _word=Substr(string,7-p+2)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802475#M315918</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;has already provided your answer.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 12:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802475#M315918</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-16T12:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802476#M315919</link>
      <description>&lt;P&gt;Your task can be much easier solved by using the right tool (Maxim 14), which is the SCAN function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
input string $7.;
last_word = scan(string,-1,"., ");
cards;
ABC.DEF
JHG GHTY
HYT,XYZ
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Mar 2022 12:31:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substr/m-p/802476#M315919</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-16T12:31:39Z</dc:date>
    </item>
  </channel>
</rss>

