<?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 Add the New changed obs only in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31027#M5943</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can change it as you wish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _n_ le 4&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or You want to pick up a proportional obs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Jan 2012 13:03:36 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2012-01-17T13:03:36Z</dc:date>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31020#M5936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Reg to keep only new once&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am having Table Test and the incr will keep on adding but i wnat to add the obs based on id and only the no is changes observations.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Data Test;&lt;BR /&gt;input id no;&lt;BR /&gt;cards;&lt;BR /&gt;1 10&lt;BR /&gt;2 11&lt;BR /&gt;3 12&lt;BR /&gt;4 13&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data inc;&lt;BR /&gt;input id no;&lt;BR /&gt;cards;&lt;BR /&gt;1 14&lt;BR /&gt;2 15&lt;BR /&gt;3 12&lt;BR /&gt;4 13&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output Test Table&lt;/P&gt;&lt;P&gt;1 10&lt;BR /&gt;2 11&lt;BR /&gt;3 12&lt;BR /&gt;4 13&lt;BR /&gt;1 14&lt;BR /&gt;2 15&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 07:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31020#M5936</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-01-17T07:19:54Z</dc:date>
    </item>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31021#M5937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How about:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;Data Test;
input id no;
cards;
1 10
2 11
3 12
4 13
;
run;


data inc;
input id no;
cards;
1 14
2 15
3 12
4 13
;
run;

proc sql;
create table want as
 select * from test
 union all corresponding
 (select * from inc
&amp;nbsp;&amp;nbsp; except
&amp;nbsp; select * from test) ;
quit;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 08:00:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31021#M5937</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-01-17T08:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31022#M5938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thqs Ksharp&amp;nbsp; small Modification can you help me in this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data Test;&lt;BR /&gt;input id no sdate ddmmyy10. Endate ddmmyy10.;&lt;BR /&gt;Format sdate Endate ddmmyy10.;&lt;BR /&gt;cards;&lt;BR /&gt;1 10 13/01/2011 .&lt;BR /&gt;2 11 13/01/2011 .&lt;BR /&gt;3 12 13/01/2011 .&lt;BR /&gt;4 13 13/01/2011 .&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data inc;&lt;BR /&gt;input id no;&lt;BR /&gt;cards;&lt;BR /&gt;1 14&lt;BR /&gt;2 15&lt;BR /&gt;3 12&lt;BR /&gt;4 13&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For the Inc Table the Sdate and Edate will be sysdate (Today Date)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output Test:&lt;BR /&gt;ID No sdate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Edate&lt;BR /&gt;1 10 13/01/2012 17/01/2012&lt;BR /&gt;2 11 13/01/2012 17/01/2012&lt;BR /&gt;3 12 13/01/2012&amp;nbsp; .&lt;BR /&gt;4 13 13/01/2012&amp;nbsp; .&lt;BR /&gt;1 14 17/01/2012&lt;BR /&gt;2 15 17/01/2012&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 08:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31022#M5938</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-01-17T08:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31023#M5939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;Data Test;
input id no sdate : ddmmyy10. Endate : ddmmyy10.;
Format sdate Endate ddmmyy10.;
cards;
1 10 13/01/2011 .
2 11 13/01/2011 .
3 12 13/01/2011 .
4 13 13/01/2011 .
;
run;

data inc;
input id no;
cards;
1 14
2 15
3 12
4 13
;
run;

proc sql;
create table temp as
 select * from inc
&amp;nbsp;&amp;nbsp; except
&amp;nbsp; select * from test(keep=id no) ;
quit;
data test;
 set test;
 if _n_ le 2 then Endate="&amp;amp;sysdate"d;
run;
data temp;
 set temp;
 sdate="&amp;amp;sysdate"d;
run;
proc append base=test data=temp force nowarn;run;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 08:37:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31023#M5939</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-01-17T08:37:37Z</dc:date>
    </item>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31024#M5940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; But you have kept&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt; set test;&lt;/P&gt;&lt;P&gt; if _n_ le 2 then Endate="&amp;amp;sysdate"d;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As i know only two observations have changed you have kept _n_ le 2 if the count increase how can i handle them&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 10:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31024#M5940</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-01-17T10:01:30Z</dc:date>
    </item>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31025#M5941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You want all the value of Endate to be SYSDATE?&lt;/P&gt;&lt;P&gt;Then remove the condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;/P&gt;&lt;P&gt; set test;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; Endate="&amp;amp;sysdate"d;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data temp;&lt;/P&gt;&lt;P&gt; set temp;&lt;/P&gt;&lt;P&gt; sdate="&amp;amp;sysdate"d;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Endate="&amp;amp;sysdate"d;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 11:36:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31025#M5941</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-01-17T11:36:34Z</dc:date>
    </item>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31026#M5942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I want the output like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output Test:&lt;BR /&gt;ID No sdate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Edate&lt;BR /&gt;1 10 13/01/2012 17/01/2012&lt;BR /&gt;2 11 13/01/2012 17/01/2012&lt;BR /&gt;3 12 13/01/2012&amp;nbsp; .&lt;BR /&gt;4 13 13/01/2012&amp;nbsp; .&lt;BR /&gt;1 14 17/01/2012&lt;BR /&gt;2 15 17/01/2012&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in the code at one poing you have written &lt;/P&gt;&lt;P&gt;if _n_ le 2 then Endate="&amp;amp;sysdate"d;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as i am having 2 obs i know and can keep _n_ le 2 if the count increae how can i do&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 12:35:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31026#M5942</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-01-17T12:35:16Z</dc:date>
    </item>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31027#M5943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can change it as you wish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if _n_ le 4&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or You want to pick up a proportional obs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 13:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31027#M5943</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-01-17T13:03:36Z</dc:date>
    </item>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31028#M5944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello. My_SAS.&lt;/P&gt;&lt;P&gt;Sorry ! I understood what you mean now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;Data Test;
input id no sdate : ddmmyy10. Endate : ddmmyy10.;
Format sdate Endate ddmmyy10.;
cards;
1 10 13/01/2011 .
2 11 13/01/2011 .
3 12 13/01/2011 .
4 13 13/01/2011 .
;
run;

data inc;
input id no;
cards;
1 14
2 15
3 12
4 13
;
run;

proc sql;
create table temp as
 select * from inc
&amp;nbsp;&amp;nbsp; except
&amp;nbsp; select * from test(keep=id no) ;
quit;
data test;
if _n_ eq 1 then do;
 length id 8;
 declare hash h(dataset:'temp');
&amp;nbsp; h.definekey('id');
&amp;nbsp; h.definedone();
&amp;nbsp; end;
 set test;
 if h.check()=0 then Endate="&amp;amp;sysdate"d;
run;

data temp;
 set temp;
 sdate="&amp;amp;sysdate"d;
run;
proc append base=test data=temp force nowarn;run;




&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 13:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31028#M5944</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-01-17T13:35:24Z</dc:date>
    </item>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31029#M5945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Thqs it worked ,is there any way to do this with out Hash keys&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 14:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31029#M5945</guid>
      <dc:creator>My_SAS</dc:creator>
      <dc:date>2012-01-17T14:07:47Z</dc:date>
    </item>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31030#M5946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I didn't read your specs fully, but the following produces the same result as long as both of your input files (i.e., test and inc) are in id order:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test (drop=b_:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; merge test (in=ina) inc (in=inb rename=(no=b_no));&lt;/P&gt;&lt;P&gt;&amp;nbsp; by id;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ina and inb then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if no ne b_no then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Endate=today();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call missing(Endate);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sdate=today();&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; no=b_no;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else if ina then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by no;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jan 2012 15:13:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31030#M5946</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-01-17T15:13:47Z</dc:date>
    </item>
    <item>
      <title>Add the New changed obs only</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31031#M5947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. Here is a pure SQL method. If you like it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;Data Test;
input id no sdate : ddmmyy10. Endate : ddmmyy10.;
Format sdate Endate ddmmyy10.;
cards;
1 10 13/01/2011 .
2 11 13/01/2011 .
3 12 13/01/2011 .
4 13 13/01/2011 .
;
run;

data inc;
input id no;
cards;
1 14
2 15
3 12
4 13
;
run;
proc sql;
create table temp as
 select * from inc
&amp;nbsp;&amp;nbsp; except
&amp;nbsp; select * from test(keep=id no) ;

create table want as
 select a.id,a.no,sdate,case when missing(b.id) then . else "&amp;amp;sysdate"d&amp;nbsp; end as Endate&amp;nbsp; format=ddmmyy10.
&amp;nbsp; from test as a left join temp as b 
&amp;nbsp;&amp;nbsp; on a.id = b.id 

 outer union&amp;nbsp; corresponding

 select *,"&amp;amp;sysdate"d as sdate&amp;nbsp; from temp
;

quit;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Jan 2012 03:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Add-the-New-changed-obs-only/m-p/31031#M5947</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-01-18T03:41:31Z</dc:date>
    </item>
  </channel>
</rss>

