Reputation:
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
LIBNAME ZIP '/server/department/analytics/data/PROJECT/';
x gzip /server/department/analytics/data/PROJECT/req1_txns1.sas7bdat;
Putty Unix
cd /server/department/analytics/data/PROJECT/
gzip req1_txns2.sas7bdat
Upvotes: 1
Views: 1531
Reputation: 6644
I like (and highly recommend) Stu's comment on using %squeeze()
to reduce disk space. But if you'd still like to zip the datasets you can use ods package
to do the same refer.
An example of using it -
libname out '/project/path/here';
filename ds1 "%sysfunc(pathname(out))/sas_ds1.sas7bdat" recfm=n;
filename ds2 "%sysfunc(pathname(out))/sas_ds2.sas7bdat" recfm=n;
filename xl1 "%sysfunc(pathname(out))/xlfile1.xlsx" recfm=n; /*ensuring binary transfer*/
ods package (zip1) open nopf; /*creates a folder in-memory*/
ods package (zip1) add file=ds1;
ods package (zip1) add file=ds2;
ods package (zip1) add file=xl1;
ods package (zip1) publish archive
properties (archive_name="my_zipfile.zip" archive_path="%sysfunc(pathname(out))");
ods package (zip1) close; /*this saves it to disk*/
After executing these, your log should state that SAS is writing zip1 to the path mentioned. And, the my_zipfile.zip
should get created in the folder you stated in the second last line publish archive properties ()
.
Upvotes: 0