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

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!

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