How do I programatically zip a file in SAS?

How do I programatically zip a file in SAS?
Who is Participating?
If you use the OPTIONS COMPRESS=YES; that will compress your sas dataset to the almost the same size as a ZIP file.  I use OPTIONS COMPRESS=YES; for all my SAS programs (set it up in the config file), and when I go to zip a SAS file it only compresses by another 1-4%.  Not really worth Zipping.

I can show you how to set the config file if so needed.
you can use the X command to call os commands with pkzip
Adding to the X command comment, you can also use WinZip through SAS commands.  If you have WinZip you need to download the WinZip Command Line Support Add-on (Free).

Here is an example to move all .txt files from a directory into a .zip file in PC SAS.

X C:;
X cd \Program Files\WinZip;
X wzzip -m "[pathname]\[filename].zip" "[pathname]\*.txt";
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.