Sunday, October 12, 2008

How to Zip and Unzip Large Datasets in SAS

Even today, memory comes at a premium. If your SAS program is generating very large dataset(s), making it problematic for you to store and retrieve using the available memory space at your disposal, you can have your SAS program zip the dataset(s) using the code below:

%sysexec %str(cd /rahman/directory;
gzip filename1..sas7bdat;);


If your program needs to read in the zipped dataset(s) at a subsequent stage, you can unzip the dataset(s) in your program using the code below:

%sysexec %str(cd /rahman/directory;
gunzip
filename1..sas7bdat.gz;);