Help using Base SAS procedures

How to deal with proc append and primary key

Reply
Regular Contributor
Posts: 240

How to deal with proc append and primary key

HI Ive a

proc append  base= myaccdb.table data=work.report4 force;

run;

i need to. Know how I can bypass the primary key that is in access when the primary key is removed it appends but I need the primary key to be there  to prevent duplicates..

Super User
Posts: 10,516

Re: How to deal with proc append and primary key

You might want to provide a few more details about what you mean by "bypass primary key".

Regular Contributor
Posts: 240

Re: How to deal with proc append and primary key

the proc append works great where it's appending data to the access table when the access table doesn't have a primary key. When I add the primary key to the access table and than run the proc append it fails I get and error message it can't insert data ... Im using force in the proc append but it doesn't append if there is a primary key...thanks again for your assistance

Super User
Posts: 5,258

Re: How to deal with proc append and primary key

Supplying the log would help. The cause of the error is usually written there.

But from the information that you give, I suppose that you are violating the PK during insert?

If so, you need to take action, primarily by fixing your data before the insert.

Data never sleeps
Super User
Posts: 10,516

Re: How to deal with proc append and primary key

By any chance is the Primary Key field in Access and automatic increment and the SAS data set you are appending have values for that field? You might be getting a collision of some sort.

Super User
Posts: 9,682

Re: How to deal with proc append and primary key

Make a audit trace for Prime Key .

Ask a Question
Discussion stats
  • 5 replies
  • 272 views
  • 0 likes
  • 4 in conversation