When I ran a dummy test step (3 files only) it worked fine:
%let zip_ref = testzip;
filename &zip_ref "~/reports/&zip_name";
ods package(&zip_ref) open nopf;
ods package(&zip_ref) add file='~/reports/BID123.html';
ods package(&zip_ref) add file='~/reports/BID124.html';
ods package(&zip_ref) add file='~/reports/BID125.html';
ods package(&zip_ref) publish archive
properties(
archive_name="test_zip.zip"
archive_path="~/reports/"
);
ods package(&zip_ref) close;
then I generated a program to zip more html files (26 instead 3 and I would like to zip much more).
when I ty to run the generated program I get an error, I do not understand why and how to fix it. All files exist in the same input folder.
the generated program is:
filename zipped "~/reports/html_ziped.zip";
ods package(zipped) open nopf;
ods package(zipped) add file='BID64.html';
ods package(zipped) add file='BID129.html';
ods package(zipped) add file='B_menu.html';
ods package(zipped) add file='M_menu.html';
ods package(zipped) add file='BID123.html';
ods package(zipped) add file='BID68.html';
ods package(zipped) add file='BID65.html';
ods package(zipped) add file='P_menu.html';
ods package(zipped) add file='BID67.html';
ods package(zipped) add file='iNat_main_v3.html';
ods package(zipped) add file='BID155.html';
ods package(zipped) add file='BID125.html';
ods package(zipped) add file='A_menu.html';
ods package(zipped) add file='BID63.html';
ods package(zipped) add file='BID47.html';
ods package(zipped) add file='BID124.html';
ods package(zipped) add file='BID128.html';
ods package(zipped) add file='F_menu.html';
ods package(zipped) add file='BID172.html';
ods package(zipped) add file='BID126.html';
ods package(zipped) add file='BID71.html';
ods package(zipped) add file='BID131.html';
ods package(zipped) add file='BID66.html';
ods package(zipped) add file='R_menu.html';
ods package(zipped) add file='BID72.html';
ods package(zipped) add file='BID130.html';
ods package(zipped) publish archive properties(archive_name="html_ziped.zip" archive_path="~/reports/");
ods package(zipped) close;
Next is the log, where "pgm" is the fileref to the generated program shown above.
120 %include pgm; NOTE: Writing ZIPPED file: ~/reports/html_ziped.zip ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/BID64.html.
When I drag the generated program to the program editor and submit I get the same error message.
But if I submit it, as a second try, I get messages that the zip file is locked.
Next is the end of the 2nd run log:
96 ods package(zipped) add file='BID72.html'; 97 ods package(zipped) add file='BID130.html'; ERROR: Resource is write-locked by another thread. File =/home/sabinun/reports/html_ziped.zip. ERROR: Resource is write-locked by another thread. File =/home/sabinun/reports/html_ziped.zip. 98 ods package(zipped) publish archive properties(archive_name="html_ziped.zip" archive_path="~/reports/"); ERROR: File is in use, /home/sabinun/reports/html_ziped.zip. 99 ods package(zipped) close; 100
Tank you @Reeza .
Shame of me - so simple solution. My eyes mislead me.
I need just to add the path to file to be zipped.
The first message is probably related to all the others.
ERROR: Physical file does not exist, /pbr/biconfig/940/Lev1/SASApp/BID64.html.
Is the path in that message where you intended to write the output? Likely not I think as there is no "Reports" in the file path. The Paths to all the files needs to start at a root for your access otherwise SAS thinks that the target or source file is in the current working directory, which you likely do not have actual access to write any files to.
Since you seem to be using the same zip file, the one that doesn't exist, that is locked by the error process as it has not been released.
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 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.