Are you able to download a file from sas studio to any device ?
I'm using SAS ODA which is similar to sas studio. After creating a great number of text files (.sas for backup, .html for my portal) I zip them all into one archieve file and download it to a local device. If it is appropriate for you - adapt the next code to zip all your excel files from work (or any other folder) and finaly download the zipped file to the prefered device.
/***********************************
/* zip all text files to an archieve
/* to be downloaded as one file
************************************/
%let fref = txtfile;
%let folder = <folder name with the files to download>;
filename &fref "~/&folder";
%let sufx = sas; /* download program files for backup */
%let zip_name = A_text_ziped.zip;
filename zipped "~/reports/&zip_name";
%let zip_ref = zipped;
/** creta a list table of files to zip to archieve **/
data dir_info;
length fname $40;
did = dopen("&fref");
members = dnum(did);
if did then
do i=1 to members;
fname = dread(did, i);
if scan(fname,2,'.') = "&sufx" then output;
end;
did = close(did);
keep fname;
run;
/** Generate a program - list of commands to execute **/
filename pgm "~/programs/ex_zipall.sas";
data _null_;
length cmd $200;
set dir_info end=eof;
*** (1) delete old zip file ***;
if _N_=1 then do;
if (fexist("&zip_ref")) then
rc = fdelete("&zip_ref");
file pgm;
cmd = "filename &zip_ref ""~/&folder/&zip_name"";";
put cmd;
cmd = cats('ods package(', "&zip_ref", ') open nopf;');
put cmd;
end;
cmd = cats('ods package(', "&zip_ref", ") add file=""~/&folder/" ,fname, """;");
file pgm; put cmd;
if eof then do;
cmd = cat("ods package(",strip("&zip_ref"),') publish archive properties(archive_name="',
"A_text_ziped.zip",'" archive_path="~/reports/");');
file pgm; put cmd;
cmd = "ods package(&zip_ref) close;";
put cmd;
end;
run;
%include pgm;
filename &zip_ref clear;
filename pgm clear;
If you don't need the excel files after downloading, you can delete them all by adapting next code:
%let folder = <folder with files to remove*/;
filename htm "&folder";
data _null_;
retain fref "reports";
length fpath $60;
did = dopen('htm');
mems = dnum(did); putlog mems=;
if did and mems then do;
do i=1 to mems;
fname = dread(did,i);
if scan(fname,-1,'.') = 'html' then do;
/* putlog i= fname=; */
fpath = cats("&root/",fname); putlog fpath=;
fc = filename(fref,fpath);
if fc=0 and fexist(fref)
then rc = fdelete(fref);
msg = sysmsg();
/* putlog msg=; */
end;
end;
did = close(did);
end;
run;
... View more