<?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: Flaging the Incremental Data_post2 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Flaging-the-Incremental-Data-post2/m-p/75722#M16326</link>
    <description>proc compare like this [pre]proc compare base= {old} compare= {new} out= differences outall outnoequal ;&lt;BR /&gt;
   id si ;&lt;BR /&gt;
run ;  [/pre] creates an output dataset in which up to 4 rows are created for each ID (si) compared.&lt;BR /&gt;
The rows on the out= data set are flagged &lt;BR /&gt;
BASE (original data)&lt;BR /&gt;
COMPARE (the new data)&lt;BR /&gt;
DIF (for each numeric variables, value difference and for differing character strings, a difference variable has "X" where a character in the string is different and "." where they are the same.)&lt;BR /&gt;
PERC percentage differences&lt;BR /&gt;
&lt;BR /&gt;
This information is not in the structure you want, but converting the information structure will provide a good test of your learning of SAS programming.&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
    <pubDate>Fri, 27 Feb 2009 14:31:38 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-02-27T14:31:38Z</dc:date>
    <item>
      <title>Flaging the Incremental Data_post2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flaging-the-Incremental-Data-post2/m-p/75721#M16325</link>
      <description>Dear All,&lt;BR /&gt;
&lt;BR /&gt;
I've two datasets (OLD &amp;amp; NEW) to compare and create an incremental report of New and Updated records (ie., only difference between the two data). Also need to flag those records in a new variable as noted below.&lt;BR /&gt;
New or Updated data can be:&lt;BR /&gt;
1) a new record added where the subject is NEW (should be flaged as NN).&lt;BR /&gt;
2) a new record added to an existing subject (flaged as NE).&lt;BR /&gt;
3) a record modified (data correction) to an existing subject (MD).&lt;BR /&gt;
&lt;BR /&gt;
data old;&lt;BR /&gt;
  input si x y z a b c;&lt;BR /&gt;
cards;&lt;BR /&gt;
1 12 23 34 45 56 67&lt;BR /&gt;
2 78 89 90 12 23 34&lt;BR /&gt;
3 45 56 67 78 89 90&lt;BR /&gt;
4 09 98 87 76 65 54&lt;BR /&gt;
5 43 32 21 09 98 87&lt;BR /&gt;
6 76 65 54 43 32 21&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data new;&lt;BR /&gt;
  input si x y z a b c;&lt;BR /&gt;
cards;&lt;BR /&gt;
1 12 23 34 45 56 67&lt;BR /&gt;
2 78 89 90 12 23 34&lt;BR /&gt;
3 45 56 67 89 78 90&lt;BR /&gt;
4 09 98 87 76 65 54&lt;BR /&gt;
4 54 65 76 87 98 09&lt;BR /&gt;
5 43 32 21 09 98 87&lt;BR /&gt;
6 76 65 54 43 32 21&lt;BR /&gt;
7 01 92 83 74 65 56&lt;BR /&gt;
8 10 29 38 47 56 65&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
In the NEW dataset, I've added&lt;BR /&gt;
2 completely new records (for variable si 7 &amp;amp; &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;BR /&gt;
1 new record to an existing variable si 4.&lt;BR /&gt;
1 record modified (data correction) to an existing variable si 3.&lt;BR /&gt;
&lt;BR /&gt;
Hence the desired out dataset should have 4 records (only incremental data) with the flags in a new variable:&lt;BR /&gt;
&lt;BR /&gt;
si  x    y     z     a    b   c    flg&lt;BR /&gt;
3  45 56 67 78 89 90 MD&lt;BR /&gt;
4  54 65 76 87 98 09 NE&lt;BR /&gt;
7  01 92 83 74 65 56 NN&lt;BR /&gt;
8  10 29 38 47 56 65 NN&lt;BR /&gt;
&lt;BR /&gt;
Awaiting your response.&lt;BR /&gt;
&lt;BR /&gt;
Best regards,&lt;BR /&gt;
Chris Nevin</description>
      <pubDate>Fri, 27 Feb 2009 12:18:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flaging-the-Incremental-Data-post2/m-p/75721#M16325</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-02-27T12:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: Flaging the Incremental Data_post2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flaging-the-Incremental-Data-post2/m-p/75722#M16326</link>
      <description>proc compare like this [pre]proc compare base= {old} compare= {new} out= differences outall outnoequal ;&lt;BR /&gt;
   id si ;&lt;BR /&gt;
run ;  [/pre] creates an output dataset in which up to 4 rows are created for each ID (si) compared.&lt;BR /&gt;
The rows on the out= data set are flagged &lt;BR /&gt;
BASE (original data)&lt;BR /&gt;
COMPARE (the new data)&lt;BR /&gt;
DIF (for each numeric variables, value difference and for differing character strings, a difference variable has "X" where a character in the string is different and "." where they are the same.)&lt;BR /&gt;
PERC percentage differences&lt;BR /&gt;
&lt;BR /&gt;
This information is not in the structure you want, but converting the information structure will provide a good test of your learning of SAS programming.&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Fri, 27 Feb 2009 14:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flaging-the-Incremental-Data-post2/m-p/75722#M16326</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-02-27T14:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Flaging the Incremental Data_post2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flaging-the-Incremental-Data-post2/m-p/75723#M16327</link>
      <description>Dear Peter,&lt;BR /&gt;
&lt;BR /&gt;
With the below PROC step, I can get the incremental data (INC) of 4 new &amp;amp; updated records:&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table INC as (select si, x, y, z, a, b, c from new&lt;BR /&gt;
except&lt;BR /&gt;
select si, x, y, z, a, b, c from old);&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
The critical part is to have flags in a new variable for these 4 records as below:&lt;BR /&gt;
&lt;BR /&gt;
si x y  z  a   b c flg&lt;BR /&gt;
3 45 56 67 78 89 90 MD&lt;BR /&gt;
4 54 65 76 87 98 09 NE&lt;BR /&gt;
7 01 92 83 74 65 56 NN&lt;BR /&gt;
8 10 29 38 47 56 65 NN&lt;BR /&gt;
&lt;BR /&gt;
Could Peter/anyone please assist me.&lt;BR /&gt;
&lt;BR /&gt;
Thank you,&lt;BR /&gt;
Chris Nevin</description>
      <pubDate>Mon, 02 Mar 2009 07:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flaging-the-Incremental-Data-post2/m-p/75723#M16327</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-03-02T07:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: Flaging the Incremental Data_post2</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Flaging-the-Incremental-Data-post2/m-p/75724#M16328</link>
      <description>Chris&lt;BR /&gt;
 &lt;BR /&gt;
have you tried the code I suggested? (or followed examples in the on-line doc in particular &lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473397.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473397.htm&lt;/A&gt; ?)&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Wed, 04 Mar 2009 15:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Flaging-the-Incremental-Data-post2/m-p/75724#M16328</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2009-03-04T15:04:46Z</dc:date>
    </item>
  </channel>
</rss>

