<?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 Reading last observation to get sequnce number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-last-observation-to-get-sequnce-number/m-p/194146#M36523</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following two datasets -&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;data filea1;&lt;BR /&gt;input id 4. desc $1.;&lt;BR /&gt;datalines;&lt;BR /&gt;100 A&lt;BR /&gt;101 B&lt;BR /&gt;102 C&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data filea2;&lt;BR /&gt;input desc $1.;&lt;BR /&gt;datalines;&lt;BR /&gt;G&lt;BR /&gt;H&lt;BR /&gt;K&lt;BR /&gt;;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to read the last observation of 'filea1' and get last id from that dataset and increment it by 1 for each observation on 'filea2'. My final dataset should look like -&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;data output1;&lt;/P&gt;
&lt;P&gt;input id 4. desc $1.;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;100 A&lt;/P&gt;
&lt;P&gt;101 B&lt;/P&gt;
&lt;P&gt;102 C&lt;/P&gt;
&lt;P&gt;103 G&lt;/P&gt;
&lt;P&gt;104 H&lt;/P&gt;
&lt;P&gt;105 K&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I achieve the same ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Apr 2015 00:35:01 GMT</pubDate>
    <dc:creator>rajat051984</dc:creator>
    <dc:date>2015-04-13T00:35:01Z</dc:date>
    <item>
      <title>Reading last observation to get sequnce number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-last-observation-to-get-sequnce-number/m-p/194146#M36523</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the following two datasets -&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;data filea1;&lt;BR /&gt;input id 4. desc $1.;&lt;BR /&gt;datalines;&lt;BR /&gt;100 A&lt;BR /&gt;101 B&lt;BR /&gt;102 C&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data filea2;&lt;BR /&gt;input desc $1.;&lt;BR /&gt;datalines;&lt;BR /&gt;G&lt;BR /&gt;H&lt;BR /&gt;K&lt;BR /&gt;;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to read the last observation of 'filea1' and get last id from that dataset and increment it by 1 for each observation on 'filea2'. My final dataset should look like -&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;data output1;&lt;/P&gt;
&lt;P&gt;input id 4. desc $1.;&lt;/P&gt;
&lt;P&gt;datalines;&lt;/P&gt;
&lt;P&gt;100 A&lt;/P&gt;
&lt;P&gt;101 B&lt;/P&gt;
&lt;P&gt;102 C&lt;/P&gt;
&lt;P&gt;103 G&lt;/P&gt;
&lt;P&gt;104 H&lt;/P&gt;
&lt;P&gt;105 K&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I achieve the same ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 00:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-last-observation-to-get-sequnce-number/m-p/194146#M36523</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-04-13T00:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reading last observation to get sequnce number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-last-observation-to-get-sequnce-number/m-p/194147#M36524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just append both datasets while following &lt;STRONG&gt;id&lt;/STRONG&gt; :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data output1;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;set filea1 filea2 (in=in2);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if in2 then i + 1; else i = id;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;id = i;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;drop i;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Apr 2015 01:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-last-observation-to-get-sequnce-number/m-p/194147#M36524</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-04-13T01:04:46Z</dc:date>
    </item>
  </channel>
</rss>

