BookmarkSubscribeRSS Feed
Chip
Calcite | Level 5
How do I append to an access database? Do I need all variables in my SAS data set or I can append to the Access table with just some of them?

I tried this, but SAS didn't like my syntax.

proc sql noprint;
connect to odbc (dsn="CBR Tracker");
execute(insert * from to_tracking into Tbl_entry1) by odbc;
disconnect from odbc;
quit;

Thanks!
1 REPLY 1
Bill
Quartz | Level 8
Don't know if this is the most efficient method, but it works.

1. Import the existing mdb into SAS
2. Append the new data to the SAS dataset
3. Export the new SAS dataset to mdb

PROC IMPORT OUT= WORK.NewOrdFaults
DATATABLE= "NewOrderFaults"
DBMS=ACCESS REPLACE;
DATABASE="\\Moftp\MainFrameFtp\NewOrderFaults.MDB";
SCANMEMO=YES;
USEDATE=YES;
SCANTIME=NO;
RUN;

data UpDater;
set NewOrdFaults
CatalogWk2;
format Delivery DeliveryWk Generate GenerateWk date9.;
run;

PROC EXPORT DATA= WORK.UpDater
OUTTABLE= "NewOrderFaults"
DBMS=ACCESS REPLACE;
DATABASE="\\MOFtp\MainFrameFtp\NewOrderFaults.MDB";
RUN;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Discussion stats
  • 1 reply
  • 1435 views
  • 0 likes
  • 2 in conversation