<?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 find nth digit in numeric string in SAS CI in SAS Customer Intelligence</title>
    <link>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/631662#M1451</link>
    <description>Thank you so much. It worked.</description>
    <pubDate>Thu, 12 Mar 2020 17:54:00 GMT</pubDate>
    <dc:creator>ravindrrapaal</dc:creator>
    <dc:date>2020-03-12T17:54:00Z</dc:date>
    <item>
      <title>How to find nth digit in numeric string in SAS CI</title>
      <link>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627247#M1433</link>
      <description>&lt;P&gt;How can i find the nth digit in a 20 digit random number.&lt;/P&gt;&lt;P&gt;Example&amp;nbsp;1753150515609025 is random number where i want find 5th digit then wanted to use for CASE statment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CASE&lt;/P&gt;&lt;P&gt;WHEN 5th digit of the&amp;nbsp;1753150515609025 is &amp;lt;2 THEN 'A'&lt;/P&gt;&lt;P&gt;WHEN 5th digit of the&amp;nbsp;1753150515609025 is &lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt; THEN 'B'&lt;/P&gt;&lt;P&gt;WHEN 5th digit of the&amp;nbsp;1753150515609025 is &amp;lt;10 THEN 'C&lt;/P&gt;&lt;P&gt;END'&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 17:12:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627247#M1433</guid>
      <dc:creator>ravindrrapaal</dc:creator>
      <dc:date>2020-02-25T17:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to find nth digit in numeric string in SAS CI</title>
      <link>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627350#M1434</link>
      <description>&lt;P&gt;Do you actually have a SAS data set to work with?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS cannot accurately store integers that long.&amp;nbsp; Is your random number a character string instead of numeric?&amp;nbsp; What's the name of that variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you working in a DATA step or in SQL?&amp;nbsp; The syntax for CASE WHEN does not appear to be correct syntax for a SAS program, but the right syntax probably depends on all of these questions being answered.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:10:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627350#M1434</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-02-25T22:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to find nth digit in numeric string in SAS CI</title>
      <link>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627388#M1435</link>
      <description>Hi Yes, I have custonerid of 10 digit, then using RANUNI function in SAS CI campaigns, once the number is genatrated and this is working with that i need to take nth digit. Please advice</description>
      <pubDate>Wed, 26 Feb 2020 03:19:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627388#M1435</guid>
      <dc:creator>ravindrrapaal</dc:creator>
      <dc:date>2020-02-26T03:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to find nth digit in numeric string in SAS CI</title>
      <link>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627392#M1436</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does your random number really need to be that long ?&lt;/P&gt;
&lt;P&gt;SAS will handle an integer up to 16 digits (&lt;A href="https://go.documentation.sas.com/?docsetId=lrcon&amp;amp;docsetTarget=p0ji1unv6thm0dn1gp4t01a1u0g6.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en#p1ikmedbli0rz2n1de001ryz895o" target="_self"&gt;doc)&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can work with that, the the following approach will find your nth digit and has the added benefit of generating Pass Thru SQL from PROC SQL (which is what CI Studio will do)&amp;nbsp; for most RDBMS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; MOD({your integer variable}, &lt;STRONG&gt;10&lt;/STRONG&gt;) – this returns the last digit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; MOD(FLOOR({your integer variable}/&lt;STRONG&gt;10&lt;/STRONG&gt;),&lt;STRONG&gt;10&lt;/STRONG&gt;) – this returns the 2&lt;SUP&gt;nd&lt;/SUP&gt; last digit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; MOD(FLOOR({your integer variable}/&lt;STRONG&gt;100&lt;/STRONG&gt;),&lt;STRONG&gt;10&lt;/STRONG&gt;) – this returns the 3&lt;SUP&gt;rd&lt;/SUP&gt; last digit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; MOD(FLOOR({your integer variable}/&lt;STRONG&gt;1000&lt;/STRONG&gt;),&lt;STRONG&gt;10&lt;/STRONG&gt;) – this returns the 4&lt;SUP&gt;th&lt;/SUP&gt; last digit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;keep adding a zero to the divisor to get the next "digit".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;James&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2020 04:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627392#M1436</guid>
      <dc:creator>JamesAnderson</dc:creator>
      <dc:date>2020-02-26T04:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to find nth digit in numeric string in SAS CI</title>
      <link>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627506#M1437</link>
      <description>&lt;P&gt;Not sure about CI, but here's a way in base SAS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;digit5 = input(substr(put(varname, 20.-L), 5), 1.);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Feb 2020 14:43:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/627506#M1437</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2020-02-26T14:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to find nth digit in numeric string in SAS CI</title>
      <link>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/631662#M1451</link>
      <description>Thank you so much. It worked.</description>
      <pubDate>Thu, 12 Mar 2020 17:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Customer-Intelligence/How-to-find-nth-digit-in-numeric-string-in-SAS-CI/m-p/631662#M1451</guid>
      <dc:creator>ravindrrapaal</dc:creator>
      <dc:date>2020-03-12T17:54:00Z</dc:date>
    </item>
  </channel>
</rss>

