<?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: proc append- stop appending duplicate observation in Base table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234301#M42838</link>
    <description>&lt;P&gt;Detailed discussion with a few solutions already on this forum&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Append-Unique-records/td-p/13104" target="_blank"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Nov 2015 21:59:32 GMT</pubDate>
    <dc:creator>JoshB</dc:creator>
    <dc:date>2015-11-11T21:59:32Z</dc:date>
    <item>
      <title>proc append- stop appending duplicate observation in Base table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234290#M42835</link>
      <description>&lt;P&gt;I have a question in proc append.&lt;/P&gt;
&lt;P&gt;I have two data sets.&lt;/P&gt;
&lt;P&gt;inv_base&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="297"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;&lt;FONT color="#333399"&gt;&lt;STRONG&gt;part_no&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="94"&gt;&lt;FONT color="#333399"&gt;&lt;STRONG&gt;Part_name&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="139"&gt;&lt;FONT color="#333399"&gt;&lt;STRONG&gt;description&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1002&lt;/TD&gt;
&lt;TD&gt;windshield&lt;/TD&gt;
&lt;TD&gt;wind shield&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1003&lt;/TD&gt;
&lt;TD&gt;steering&lt;/TD&gt;
&lt;TD&gt;steering wheel&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1004&lt;/TD&gt;
&lt;TD&gt;Tire&lt;/TD&gt;
&lt;TD&gt;Good Year tire&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;inv_tr&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="249"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;&lt;FONT color="#000080"&gt;part_no&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64"&gt;&lt;FONT color="#000080"&gt;Part_name&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="121"&gt;&lt;FONT color="#000080"&gt;description&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1001&lt;/TD&gt;
&lt;TD&gt;mirror&lt;/TD&gt;
&lt;TD&gt;front mirror&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1003&lt;/TD&gt;
&lt;TD&gt;steering&lt;/TD&gt;
&lt;TD&gt;steering wheel&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am using proc append to concatenate these two datasets.&lt;/P&gt;
&lt;P&gt;proc append base=inv_base data=inv_tr force;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;After append I have duplicate records in base dataset.&lt;/P&gt;
&lt;P&gt;How can I stop appending duplicate records in other words how can I stop adding a record that is already exist in base dataset.?&lt;/P&gt;
&lt;P&gt;is there any other way I can get the required result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 21:02:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234290#M42835</guid>
      <dc:creator>nbonda</dc:creator>
      <dc:date>2015-11-11T21:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: proc append- stop appending duplicate observation in Base table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234296#M42836</link>
      <description>&lt;P&gt;There are other choices:&amp;nbsp; SET statement, MERGE statement, UPDATE statement, even PROC SQL.&amp;nbsp; All of these choices will take longer to run.&amp;nbsp; PROC APPEND does not have to process records in the BASE= data set, only add to it.&amp;nbsp; But other choices require processing the records in both data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To pick the best method, you'll have to think about how to handle conflicts.&amp;nbsp; For example, suppose one data set contains:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;10003&amp;nbsp;&amp;nbsp; steering&amp;nbsp;&amp;nbsp; steering wheel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But the other contains&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;10003&amp;nbsp;&amp;nbsp; steering&amp;nbsp;&amp;nbsp; leather steering wheel&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What should the outcome be in that case?&amp;nbsp; Once you have made your choices, the programming can begin.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 21:23:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234296#M42836</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-11-11T21:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: proc append- stop appending duplicate observation in Base table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234301#M42838</link>
      <description>&lt;P&gt;Detailed discussion with a few solutions already on this forum&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/Append-Unique-records/td-p/13104" target="_blank"&gt;here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2015 21:59:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234301#M42838</guid>
      <dc:creator>JoshB</dc:creator>
      <dc:date>2015-11-11T21:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: proc append- stop appending duplicate observation in Base table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234303#M42839</link>
      <description>To identify that a new record is a duplicate either needs some kind of merge or for the "master" table to be indexed on the keys that would define duplicates.&lt;BR /&gt;Proc Append is very effective without duplicates check because of that reason. With an indexed "master" similar efficiency - avoiding the rewriting of all rows in the "master" - is available by using SQL INSERT or by using the data step MODIFY statement. See the examples in the online doc.&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Nov 2015 22:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234303#M42839</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2015-11-11T22:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: proc append- stop appending duplicate observation in Base table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234317#M42841</link>
      <description>&lt;P&gt;Please try the SYNCADD option in your PROC APPEND step as shown below. The rejects will be saved with the UNIQUESAVE option.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(syncadd=no uniquesave=yes)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please refer to the following URL for detailed explanation with example &amp;amp; log.....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/engspde/67961/HTML/default/viewer.htm#p105mkhis1sjfln1qvfb1366mp4p.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/engspde/67961/HTML/default/viewer.htm#p105mkhis1sjfln1qvfb1366mp4p.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good Luck...!!!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 03:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234317#M42841</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-12T03:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: proc append- stop appending duplicate observation in Base table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234329#M42845</link>
      <description>&lt;P&gt;It might be worthwhile to note that the OPTIONS syntax SYNCADD and UNIQUESAVE does not work on normal libraries. I tried and the syntax wasn't recognized (without SPDE). &amp;nbsp;You need to define your library where you have the master dataset as as SPD engine. I found some literature on SPD (Scalable Performance Data) listed below that may help provide some background from SAS 9. The document reveals many things of which the primary focus of SPD is for rapid data access with heavy CPU operation through parallel processing and multithreading operations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/engspde/62981/PDF/default/engspde.pdf" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/engspde/62981/PDF/default/engspde.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the example, I tried out using SPDE in the LIBNAME statement that provided the desired PROC APPEND result eliminating duplicates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname lib1 spde '/folders/myfolders/.sasstudio/';
data lib1.d1(index=(name/unique));
     set sashelp.class(obs=5);
run;
data d2(index=(name/unique));
     set sashelp.class(obs=7 firstobs=4);
run;
proc append base=lib1.d1(syncadd=no uniquesave=yes) data=work.d2 ;
run;
proc print data=lib1.d1; title '==d1 after unique append==';
run;
proc print data=&amp;amp;spdsusds; title '==Uniques append rejects==';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The result it produced is here for your reference:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;==d1 after unique append==
Obs	Name	Sex	Age	Height	Weight
1	Alfred	M	14	69.0	112.5
2	Alice	F	13	56.5	84.0
3	Barbara	F	13	65.3	98.0
4	Carol	F	14	62.8	102.5
5	Henry	M	14	63.5	102.5
6	James	M	12	57.3	83.0
7	Jane	F	12	59.8	84.5
==Uniques append rejects==
Obs	Name	Sex	Age	Height	Weight	XXX00000
1	Carol	F	14	62.8	102.5	Name
2	Henry	M	14	63.5	102.5	Name&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps...!!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2015 05:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/proc-append-stop-appending-duplicate-observation-in-Base-table/m-p/234329#M42845</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-12T05:52:46Z</dc:date>
    </item>
  </channel>
</rss>

