Help using Base SAS procedures

Appending data to an MS Access File

Reply
Super Contributor
Posts: 292

Appending data to an MS Access File

I'm looking for a way to append SAS data to an existing ms access file in such a way as to retain the keys that have been set up in the access file.  Proc Export only allows a replace.  Is there another method to write to ms access that will append to the access file?

Thank you!

Bill

Frequent Contributor
Posts: 101

Re: Appending data to an MS Access File

I've used proc append successfully to add more data to an existing Access table. Here's an example:

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

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

* append more data to existing table;
proc append base=myaccdb.class data=sashelp.class;
run;

libname myaccdb clear;

Super User
Posts: 10,041

Re: Appending data to an MS Access File

OR do you consider using SQL ?

Super Contributor
Posts: 292

Re: Appending data to an MS Access File

Ksharp, I would try it if I had the sql code to do so.  Are you able to provide an example?

Thanks,

Bill

Super User
Posts: 10,041

Re: Appending data to an MS Access File

Actually it is almost like  SAS_Bigot 's :

libname myaccdb access 'c:\x.mdb';

*append more data to existing table;

proc sql ;

insert into  myaccdb.xx

select * from  class ;

quit;

libname myaccdb clear;

Not tested. not sure whether it can work.

Ksharp

Ask a Question
Discussion stats
  • 4 replies
  • 2702 views
  • 0 likes
  • 3 in conversation