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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 915 views
  • 0 likes
  • 3 in conversation