<?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 Pulling specific numeric value based on position in data in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Pulling-specific-numeric-value-based-on-position-in-data/m-p/677878#M79384</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I have an easy one and multiple ways to go about it but I just can't get it to work as I'm used to character formats and I'm trying to do this with a numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Datahave&lt;/P&gt;&lt;P&gt;123456789&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Datawant&lt;/P&gt;&lt;P&gt;896712345&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Last two become the first two, second to last 2 become the 2nd 2 and finally first 5 become last 5.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2020 18:03:44 GMT</pubDate>
    <dc:creator>BillyHarper</dc:creator>
    <dc:date>2020-08-19T18:03:44Z</dc:date>
    <item>
      <title>Pulling specific numeric value based on position in data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Pulling-specific-numeric-value-based-on-position-in-data/m-p/677878#M79384</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I have an easy one and multiple ways to go about it but I just can't get it to work as I'm used to character formats and I'm trying to do this with a numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Datahave&lt;/P&gt;&lt;P&gt;123456789&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Datawant&lt;/P&gt;&lt;P&gt;896712345&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Last two become the first two, second to last 2 become the 2nd 2 and finally first 5 become last 5.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 18:03:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Pulling-specific-numeric-value-based-on-position-in-data/m-p/677878#M79384</guid>
      <dc:creator>BillyHarper</dc:creator>
      <dc:date>2020-08-19T18:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling specific numeric value based on position in data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Pulling-specific-numeric-value-based-on-position-in-data/m-p/677882#M79385</link>
      <description>&lt;P&gt;Use a character value as go-between:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;charval = put(numval,z9.);
charval = substr(charval,8,2) !! substr(charval,6,2) !! substr(charval,1,5);
numval_new = input(charval,9.);
drop charval;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Another, pure numerical way would involve multiple use of divisions, INT and MOD functions.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 18:26:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Pulling-specific-numeric-value-based-on-position-in-data/m-p/677882#M79385</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-08-19T18:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: Pulling specific numeric value based on position in data</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Pulling-specific-numeric-value-based-on-position-in-data/m-p/677888#M79386</link>
      <description>&lt;P&gt;A purely numeric method would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
array _i{9};
array _o{*} _i8 _i9 _i6 _i7 _i1 _i2 _i3 _i4 _i5;
numIn = 123456789;
_x = numIn;
do i = dim(_i) to 1 by -1;
    _i{i} = mod(_x, 10);
    _x = int(_x/10);
    end;
_x = 0;
do i = 1 to dim(_o);
    _x = _x*10 + _o{i};
    end;
numOut = _x;
drop i _:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This kind of math occurs behind the scene whenever you convert between number and character.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 19:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Pulling-specific-numeric-value-based-on-position-in-data/m-p/677888#M79386</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-08-19T19:24:36Z</dc:date>
    </item>
  </channel>
</rss>

