BookmarkSubscribeRSS Feed
JohnH
Fluorite | Level 6
Is there any simple code which will export an entire sas library to an MS ACCESS database, with each SAS Dataset tranlated to a table within the database? I am hoping that I am just failing to find a simple option. I see the PROC EXPORT code to convert one data set, but I will have over 1,000 datasets withing one SAS library to convert. Thanks, John
2 REPLIES 2
Tim_SAS
Barite | Level 11
This question is perhaps best answered by Technical Support. You can open a track using

http://support.sas.com/techsup/contact/submit_emits2.html .
Olivier
Pyrite | Level 9
Although I've never encountered such an option, I would suggest quite simple workarounds using macro loops (or call execute) and the use of the SASHELP.VTABLE view (or proc contents).
Something like :

%MACRO move2access (library, outDB) ;
DATA _NULL_ ;
SET sashelp.vtable (WHERE = (UPCASE(libname) = UPCASE("&library"))) ;
nDataSets + 1 ;
CALL SYMPUT (COMPRESS("DSname"!!nDataSets), memname) ;
CALL SYMPUT ("DSn", nDataSets) ;
RUN ;
%DO i = 1 %TO &DSn ;
PROC EXPORT DATA = &&library..&&DSname&i
OUTTABLE = "&&DSname&i"
DBMS = ACCESS REPLACE ;
DATABASE = "&outDB" ;
RUN ;
%END ;
%MEND move2access ;

And call it like :

%move2access (sasuser, c:\sasuser.db) ;

I hope it fits.

Olivier Decourt
Training & consulting on SAS software and statistical topics
France

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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
  • 1352 views
  • 0 likes
  • 3 in conversation