BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Gil_
Quartz | Level 8
Here is my code

proc export data=sashelp.class
   table=class
   dbms=access2007 replace;
   database='c:\data\test.accdb';
run;

libname myaccdb 'c:\data\test.accdb';

proc append base=myaccdb.class data=sashelp.class;
run;

libname myaccdb clear
My question is i have a primary key thats get removed which will allow duplication. How can i keep my primary key?
1 ACCEPTED SOLUTION

Accepted Solutions
pink_poodle
Barite | Level 11

In this post, they use proc datasets with some success:

 

https://communities.sas.com/t5/Integration-with-Microsoft/How-do-I-append-a-SAS-data-set-into-ACCESS...

 

proc datasets library = accdb nolist;
append base = myaccdb.class 
data = sashelp.class;
force;
run;
quit;

View solution in original post

2 REPLIES 2
pink_poodle
Barite | Level 11

In this post, they use proc datasets with some success:

 

https://communities.sas.com/t5/Integration-with-Microsoft/How-do-I-append-a-SAS-data-set-into-ACCESS...

 

proc datasets library = accdb nolist;
append base = myaccdb.class 
data = sashelp.class;
force;
run;
quit;
singhsahab
Lapis Lazuli | Level 10

Hi Gil,

 

if you want to append data sets , first you have to remove Primary key constraint, as you know it wouldn't allow duplicate values.   

 

or

 

Proc append will run without any error but in log you will get warning . Like " Add/Update failed for data set because data value(s) do not comply with integrity constraint primary key, number of  observations rejected." 

 

Thanks,

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1312 views
  • 0 likes
  • 3 in conversation