The SAS Output Delivery System and reporting techniques

exporting an entire library to access

Reply
Contributor
Posts: 73

exporting an entire library to access

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
Super Contributor
Posts: 394

Re: exporting an entire library to access

This question is perhaps best answered by Technical Support. You can open a track using

http://support.sas.com/techsup/contact/submit_emits2.html .
Super Contributor
Posts: 260

Re: exporting an entire library to access

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
Ask a Question
Discussion stats
  • 2 replies
  • 148 views
  • 0 likes
  • 3 in conversation