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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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