BookmarkSubscribeRSS Feed
user112a2
Obsidian | Level 7

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
4 REPLIES 4
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

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;
Reeza
Super User
Are you already using the SAS Compress option?
VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

yes I do compress prior to zipping.  the zipping files I do pack lots of datasets into one file for archiving.

 

Kurt_Bremser
Super User

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.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 4 replies
  • 3589 views
  • 2 likes
  • 4 in conversation