OPTIONS PS=MAX LS=MAX NOCENTER SASMSTORE=SASUSER MSTORED MAUTOSOURCE;
%MACRO run_package(file_path,file_name_houzhui,package_path,package_name_houzhui)/store;
/*设置路径*/
%let dir=&file_path.;
%let dir1=&package_path.;
ods package open nopf;
ods package add file="&dir&file_name_houzhui" mimetype="text/plain";/*添加文件到压缩包*/
/*创建压缩包,制定压缩包名字、路径*/
ods package publish archive properties (archive_name="&package_name_houzhui" archive_path="&dir1");
ods package close;
%MEND;
%run_package(.data,pct.csv,.,pct.tar)
若是多个同样的文件需要压缩
OPTIONS PS=MAX LS=MAX NOCENTER SASMSTORE=SASUSER MSTORED MAUTOSOURCE;
%MACRO package_tar(file_path,package_path,NUM,package_name_tar)/store;
/*设置路径*/
%let dir=&file_path.;
%let dir1=&package_path.;
ods package open nopf;
/*添加xml到压缩包*/
%DO I=1 %TO #
ods package add file="&dircase&I..xml" mimetype="text/plain";
%END;
/*创建压缩包,制定压缩包名字、路径*/
ods package publish archive properties (archive_name="&package_name_tar" archive_path="&dir1");
ods package close;
%MEND;
OPTIONS PS=MAX LS=MAX NOCENTER SASMSTORE=SASUSER MSTORED MAUTOSOURCE;
%package_tar(.xml,.,6,xml.tar)
/*%package_tar(file_path,package_path,NUM,package_name_tar)
第一个参数file_path是要压缩的文件路径,
第二个参数package_path是压缩包的存放路径,
第一个参数NUM是要压缩的文件个数,
第一个参数package_name_tar是压缩包的名称,带后缀,
*/