What are the best ways to zip SAS data sets? Below is the code that I have tried using SAS and Putty. In SAS, I did not get a log saying this was successful or not. I did get an ! exclamation point. In Putty, I also did not get any message if successful or not. What are the best and fastest ways to zip large data sets in SAS or Putty? Also, is there a way to do multiple data sets at once? Also, I think a log would be nice as well. Thank you!
SAS
Removed
Putty Unix
Removed
this is one way I do some zipping
%macro zipit;
ods package(zip) open nopf;
proc sql;
create table sasds as
select *
from dictionary.tables
where libname = 'WORK';
quit;
option nonotes;
%do %while (&sysnobs > 0);
data sasds;
set sasds;
if _N_ = 1 then call symputx('FN',memname);
else output;
run;
%put Archive %sysfunc(PATHNAME(mysas))\&fn..sas7bdat;
ods package(zip) add file="%sysfunc(PATHNAME(WORK))\&fn..sas7bdat";
%end;
option notes;
ods package(zip)
publish archive
properties (archive_name = "WORK.zip"
archive_path = "\\&mypath.");
ods package(zip) close;
%mend zipit;
%zipit;
yes I do compress prior to zipping. the zipping files I do pack lots of datasets into one file for archiving.
gzip accepts a list of filenames on the commandline.
To see output of external commands in the SAS log, do this:
filename oscmd pipe "gzip filenames 2>&1";
data _null_;
infile oscmd;
input;
put _infile_;
run;
If you count the input lines, you can check for success; gzip will return no output if it succeeded completely.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.