New Contributor
Posts: 4

Trying to use pkzip25 with SAS 9.4

Hi all,

I am new to asking questions, but I really need some help.

We have just moved from Base SAS 9.3 to 9.4

The problem is that we have a macro as shown below, to zip required files before sending info to clients.

%sleep(10);
%MEND;

This is the parameters set for the ZIP file within the MAKEZIP.BAT file.

\pkzip25 -add  -pass = %4 %1\%2 %1\%3

I have attached the log of the above.

No matter what I do, Statement is not valid is the result.

After migration, pkzip is not working anymore so we had to move over to something that does work.

ods package(newzip) open nopf;
ods package(newzip) publish archive
properties(
archive_name="TestingZIP2_&MON1_MONYY7..zip"
archive_path="C:\Users\F3340945\Documents\SAS_Testing\"
);
ods package(newzip) close;

The HUGE PROBLEM is that we cannot password protect the file using ODS Package.

Has some one had this problem or do you know of a solution we can use?

Colleen

Super User
Posts: 7,975

Re: Trying to use pkzip25 with SAS 9.4

Hi,

Well, my answer is two pronged here.  Firstly data transfer is a process, so you would have you process documentation, validation etc. Its not just as simple as packaging some data and sending it on.  So as part of the process you could just have a step which packages all the relevant parts into a ZIP as a manual step (or batch if necessary) - so including logs, contents etc.  So in all the cases I have done this its a manual step anyways.

Now secondly, and more relevant, pkzip is an application.  Most of these compression utilities have a command line accessible functionality.  What does this mean, well before the age Windows and the fancy icons was the time of the command line when you had to type everything in, this is still there behind the scenes, and you can see this by going to Start and typing cmd in the find box and clicking on that which opens the command line. What your SAS program is doing is sending operating system commands out to the operating system to execute:

This is saying, run the batch file located in the given path with some parameters.

\pkzip25 -add  -pass = %4 %1\%2 %1\%3

This in your batch file is executing pkzip25.exe (probably exe) with some command line parameters.

Now there is several things that can go wrong here.  Have you made sure that the systask is working, i.e. does it find that path, and is the batch file there?

Secondly, is this pkzip25.exe present somewhere, and is it in the system path.  Normally I would always make sure to specify full path to the file.  Its likely to be this, is the new SAS on a new server that can't find the pk exe, fully specifying where the exe is would solve that assuming you have the access rights.  So I would speak to your IT and ask them to a) find the program, b) check your access rights, and c) then you can update the batch file accordingly.

You can also simply your code, and get feedback by using:

filename test pipe '"c:\full_path\to_pkzip\pkzip25.exe" -add -pass = &input. &path.\&zipname..zip &path.\&input.';

data results;
length test $; infile test; input ret$;
run;

Executing it this way yeilds a dataset with the results of the action.

New Contributor
Posts: 4

Re: Trying to use pkzip25 with SAS 9.4

With SAS9.3, the pkzip25.exe did zip & password protect our files with no problem. After upgrading to SAS 9.4, the external zipping did not work at all - using the same parameters as we had used for 9.3.
I will check and run zip as you have shown previously with the path showing
Thank you.

To read FirstRand Bank's Disclaimer for this email click on the following address or copy into your Internet browser:

If you are unable to access the Disclaimer, send a blank e-mail to
firstrandbankdisclaimer@fnb.co.za and we will send you a copy of the Disclaimer.
Super User
Posts: 7,827

Re: Trying to use pkzip25 with SAS 9.4

"did not work at all" is NOT helpful. I hate to repeat myself, but how did it fail? Were you unable to call external commands from SAS, is the pkzip25 no longer available, or does pkzip25 suddenly fail with error messages?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Posts: 7,975

Re: Trying to use pkzip25 with SAS 9.4

Your post seems to have additional information you may not have wanted to post.

Anyways, yes, you need to speak with the people that installed the new SAS.  Anything could have changed there, they can have installed to a new server, an new area, not migrated priviledges over, not installed pkzip etc.  Lots of things can go wrong, and as they can see the system and we can't they would be best placed to answer this, it maybe as simple as updating the system path to include the path to pkzip25 - this is why I always recommend putting full path in so this is not a problem.

Super User
Posts: 7,827

Re: Trying to use pkzip25 with SAS 9.4

Quote:

"After migration, pkzip is not working anymore so we had to move over to something that does work"

How does it "not work anymore"? Don't you have it installed, or can't you call it from SAS?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Discussion stats
• 5 replies
• 151 views
• 0 likes
• 3 in conversation