BookmarkSubscribeRSS Feed
ColleenCB
Fluorite | Level 6

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.

 

%MACRO zipit(path,input,zipname,password);
SYSTASK COMMAND "\\shr-backup01\systems\Templates\makezip.bat &path. &zipname..zip &input. &password.";
%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) add file="C:\Users\F3340945\Documents\SAS_Testing\ZIPTESTING_&MON1_MONYY7..XLSX";
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?

 

Really appreciate your help.

Colleen

5 REPLIES 5
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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:

SYSTASK COMMAND "\\shr-backup01\systems\Templates\makezip.bat &path. &zipname..zip &input. &password.";

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.

 

ColleenCB
Fluorite | Level 6
Thank you for your feedback.
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:
https://www.fnb.co.za/about-fnb/legal-matters/email-disclaimer.html

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.
Kurt_Bremser
Super User

"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?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Kurt_Bremser
Super User

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?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1083 views
  • 0 likes
  • 3 in conversation