Help using Base SAS procedures

PROC APPEND - Warning related to Integrity Constraint

Accepted Solution Solved
Reply
Contributor
Posts: 28
Accepted Solution

PROC APPEND - Warning related to Integrity Constraint

Hi,

 

Getting below warning message while running a PROC APPEND step to append a WORK.DST_A_WRK to PRMLB.DST_A.

 

PROC APPEND BASE = PRMLB.DST_A 
DATA = WORK.DST_A_WRK ;

 

WARNING: Add/Update failed for data set PRMLB.DST_A because data value(s) do not comply with integrity constraint PK_COL1, 999 observations rejected

 

PK_COL1 is a primary constraint defined on managed ID key field COL1 (Numeric) in the table PRMLB.DST_A. First run went fine as it was first time the dataset PRMLB.DST_A getting loaded. Getting above warning message during the second run.

 

DST_A has around 16 variables (COL1 - COL16).

 

Statement used to create integrity constraint is as below

 

CONSTRAINT PK_COL1 PRIMARY KEY (COL1)

 

Dataset WORK.DST_A_WRK used in PROC APPEND has difference in number of observations than PRMLB.DST_A

 

I have gone through link http://support.sas.com/kb/38/162.html but it mentions about order of many integrity constraints causing above warning, in my case I just have one integrity constraint PK_COL1.

 

Could someone please help me with what may be the reasons?


Accepted Solutions
Solution
‎02-21-2018 08:57 AM
Super User
Posts: 5,878

Re: PROC APPEND - Warning related to Integrity Constraint

[ Edited ]
Posted in reply to nrk1787db1_gmail_com

The reason is clear: you are violating the PK by adding those rows.
If the PK is relevant you need to change your update approach. Like decide whether you only wish to add records for new keys, or update rows with a key match.

Data never sleeps

View solution in original post


All Replies
Super User
Posts: 10,778

Re: PROC APPEND - Warning related to Integrity Constraint

Posted in reply to nrk1787db1_gmail_com

Can you delete that IC ?

 

proc datasets lib=.........

modify DST_A;

ic delete PK_COL1;

quit;

Solution
‎02-21-2018 08:57 AM
Super User
Posts: 5,878

Re: PROC APPEND - Warning related to Integrity Constraint

[ Edited ]
Posted in reply to nrk1787db1_gmail_com

The reason is clear: you are violating the PK by adding those rows.
If the PK is relevant you need to change your update approach. Like decide whether you only wish to add records for new keys, or update rows with a key match.

Data never sleeps
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 148 views
  • 1 like
  • 3 in conversation