<?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: Create a monotonic value from a given value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570508#M160878</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192091"&gt;@ger15xxhcker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below should work as well:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select max(id) into :max_id trimmed
  from table1
  ;
quit;

data table2_want;
  set table2;
  id=sum(&amp;amp;max_id,_n_);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 02 Jul 2019 12:02:34 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2019-07-02T12:02:34Z</dc:date>
    <item>
      <title>Create a monotonic value from a given value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570477#M160865</link>
      <description>&lt;P&gt;Hi all!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to continue numbering from a fixed number. There is a table in one id eg: 101 . And there is another table where this id is not filled and I want to continue the numbering like a monotonic number in this field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope I have made it clear example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570477#M160865</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2019-07-02T10:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monotonic value from a given value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570478#M160866</link>
      <description>&lt;P&gt;Just to get things started, lets assume your data looks like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Table1;
input id var;
datalines;
1 10
2 20
3 30
4 40
5 50
;

data Table2;
input id var;
datalines;
. 10
. 20
. 30
. 40
. 50
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;From what I understand, you want the Id values in Table2 to be filled with values 6, 7, 8, 9 and 10, correct?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:39:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570478#M160866</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-02T10:39:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monotonic value from a given value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570480#M160868</link>
      <description>&lt;P&gt;Exactly!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 10:46:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570480#M160868</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2019-07-02T10:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monotonic value from a given value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570490#M160873</link>
      <description>&lt;P&gt;This approach does not require the data to be sorted&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Table1;
input id var;
datalines;
3 30
2 20
5 50
4 40
1 10
;

data Table2;
input id var;
datalines;
. 10
. 20
. 30
. 40
. 50
;

data want(drop=_:);
    do until (lr1);
        set Table1 end=lr1;
        if id gt _id then _id=id;
    end;
    do _N_=1 by 1 until (lr2);
        set Table2 end=lr2;
        id=_id+_N_;
        output;
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jul 2019 11:06:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570490#M160873</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-07-02T11:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monotonic value from a given value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570508#M160878</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/192091"&gt;@ger15xxhcker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below should work as well:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select max(id) into :max_id trimmed
  from table1
  ;
quit;

data table2_want;
  set table2;
  id=sum(&amp;amp;max_id,_n_);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jul 2019 12:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570508#M160878</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-07-02T12:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monotonic value from a given value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570510#M160879</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 12:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-monotonic-value-from-a-given-value/m-p/570510#M160879</guid>
      <dc:creator>ger15xxhcker</dc:creator>
      <dc:date>2019-07-02T12:05:57Z</dc:date>
    </item>
  </channel>
</rss>

