DATA Step, Macro, Functions and more

Specifying all data sets within a session

Reply
Contributor
Posts: 29

Specifying all data sets within a session

My server is being rebooted shortly.

I'm trying to dump all of the data sets from the server work directory onto my pc so I can upload them again when the servers back online.

The code I'm trying to run is as follows;



RSUBMIT ;

LIBNAME drive 'C:\temp\sessiondump';

PROC COPY IN=SASCATCA OUT=drive ;
SELECT _ALL_ ;
RUN ;

ENDRSUBMIT ;



This code works if I individually list all of the datasets in the SELECT statement.

As the session has a few hundered data sets, I'm wanting to specify the entire contents using a single reference.

My first thought was _ALL_ but this isn't working.

Any ideas?

Any help with this would be appreciated.

Cheers,

Fat Captain.
Super Contributor
Super Contributor
Posts: 365

Re: Specifying all data sets within a session

Hello,

It is possible to create a list of tables from the work library:
[pre]
proc SQL noprint;
select memname into :tablst separated by " "
from sashelp.vmember
where libname="WORK"
;quit;
[/pre]
and then use it in proc COPY:
[pre]
select &tablst;
[/pre]

SPR
Valued Guide
Posts: 632

Re: Specifying all data sets within a session

If you do not use the SELECT statement the default is everything of the given memtype.
Super User
Posts: 9,681

Re: Specifying all data sets within a session

Hi. Art Carpenter is right. Remember SAS syntax is very flexible.
To incorporate Arc's view,you can use modify input or list input ,Such as

[pre]

select a: b: art1-art100;
[/pre]

a: stand for any name of data set which start with alphabetical ' a ';


Ksharp
Frequent Contributor
Posts: 127

Re: Specifying all data sets within a session

Hi,

You could also create a remote library pointing the WORK library of your server, and then use the datasets procedure in order to move all datasets from that remote library to a local library.

Code is to be executed on the local session (outside of the RSUBMIT/ENDRSUBMIT) and before signing off your connection with the server.

libname rwork server= slibref=work;

proc datasets nolist;
copy in=rwork out=work;
quit;
run;

I hope it helps.

Regards,
Florent
Contributor
Posts: 29

Re: Specifying all data sets within a session

Thank you all for your help.

You've got to love SAS for the flexability it offers.

Cheers,

Fat Captain.
Ask a Question
Discussion stats
  • 5 replies
  • 125 views
  • 0 likes
  • 5 in conversation