<?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: value begining and ending with specific number in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/value-begining-and-ending-with-specific-number/m-p/336372#M62996</link>
    <description>&lt;P&gt;If character field, look at the SUBSTR() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If numeric field look at the SUBSTRN() function.&lt;/P&gt;
&lt;P&gt;The REVERSE() function will reverse a string so you can obtain the last character. Or you could use the LENGTH function to get the last character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since it looks character, consider using the reverse function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if substr(char, 1,1) = '5' and substr(trim(reverse(char)), 1,1) ne '1' then status='Uncontrolled';&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 27 Feb 2017 22:54:16 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-02-27T22:54:16Z</dc:date>
    <item>
      <title>value begining and ending with specific number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/value-begining-and-ending-with-specific-number/m-p/336367#M62994</link>
      <description>&lt;P&gt;Hi!&amp;nbsp; I have a variable (concurrentcrg)..and I need to flag all the observations with values that start with 5 but do not end in 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here the line of code that did not work...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if concurrentcrg in: ('5') and concurrentcrg ne '%1' then status='Uncontrolled';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Help is appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 22:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/value-begining-and-ending-with-specific-number/m-p/336367#M62994</guid>
      <dc:creator>jenim514</dc:creator>
      <dc:date>2017-02-27T22:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: value begining and ending with specific number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/value-begining-and-ending-with-specific-number/m-p/336369#M62995</link>
      <description>&lt;P&gt;Is it a character or numeric field?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 22:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/value-begining-and-ending-with-specific-number/m-p/336369#M62995</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-27T22:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: value begining and ending with specific number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/value-begining-and-ending-with-specific-number/m-p/336372#M62996</link>
      <description>&lt;P&gt;If character field, look at the SUBSTR() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If numeric field look at the SUBSTRN() function.&lt;/P&gt;
&lt;P&gt;The REVERSE() function will reverse a string so you can obtain the last character. Or you could use the LENGTH function to get the last character.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since it looks character, consider using the reverse function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if substr(char, 1,1) = '5' and substr(trim(reverse(char)), 1,1) ne '1' then status='Uncontrolled';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Feb 2017 22:54:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/value-begining-and-ending-with-specific-number/m-p/336372#M62996</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-27T22:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: value begining and ending with specific number</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/value-begining-and-ending-with-specific-number/m-p/336376#M62997</link>
      <description>&lt;P&gt;Assuming it's character, then:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if first(concurrentcrg) eq '5' and first(reverse(strip(concurrentcrg))) ne '1'
    then status='Uncontrolled';
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2017 23:04:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/value-begining-and-ending-with-specific-number/m-p/336376#M62997</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-02-27T23:04:21Z</dc:date>
    </item>
  </channel>
</rss>

