SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
Billybob73
Quartz | Level 8

Hi

7Zip is installed on my SAS BI server, which is great because we have to zip with encryption.

I've read somewhere on this platform how to zip a single file and this works :

 

data _null_;
zipexe='"<path to 7zip executable>\7z.exe" a -tzip -pPASSWORD';
zipfile="<zip target path>\<zipfile>.zip";
file="<zip source path>\<file to be zipped>.<extension>";
cmd = zipexe ||' "'|| zipfile ||'" "'|| file ||'"' ;
call system(cmd);
run;

 

I've been trying to zip a whole folder by googling for command lines for 7zip but was not successful.

 

Anybody knows how to do this ?

 

Thanks!

RGDS

B

 

1 REPLY 1
Kurt_Bremser
Super User

First of all, test your commandline from a cmd window outside of SAS.

Then, run it from SAS with a FILENAME PIPE:

filename oscmd pipe "your complete command 2>&1";

data _null_;
infile oscmd;
input;
put _infile_;
run;

then look at your log, you will find all responses from the system.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1046 views
  • 0 likes
  • 2 in conversation