BookmarkSubscribeRSS Feed
forumsguy
Fluorite | Level 6

Hi All,

I have source table, target table and control table.

In first run, my target table will be loaded completely, but in second run only new records should be loaded and duplicate records should be loaded to control table. How to implement that ?? Need some help.

Source table run1

var1 var2var3
102030
405060

Target table run1

var1 var2var3
102030
405060

Control table run1

Job_nameStatusvar_ListNo of rowsDateDuplicates
SampleSuccessvar1,var2,var3217-Jul-14N

Now in run2 Source is

var1 var2var3
506070
405060

Target should be

var1 var2var3
102030
405060
506070

Control table should be

Job_nameStatusvar_ListNo of rowsDateDuplicates
SampleSuccessvar1,var2,var3217-Jul-14N
SampleSuccessvar1,var2,var3117-Jul-14Y

Any help is highly appreciated

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Why not just load the dataset as normal then do a proc sort nodupkey dupout=?  E.g. This would then give you a table with distinct rows and a table with the duplicates.  You can then post-process the duplicates to get your control dataset.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 825 views
  • 0 likes
  • 2 in conversation