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,

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 861 views
  • 0 likes
  • 3 in conversation