Hi Community,
I need your help with the above mentioned task. I have surfed the internet to find answers for this and was not much of a help.
Please advise.
data _null_ ;
unzipcmd='"C:\Program Files\WinZip\Winzip64.exe" -min -e -o -s' ;
pw='"qwerty"' ;
zipfile="O:\Data\20220205.zip" ;
whereto='C:\' ;
cmd=unzipcmd || pw || ' ' || zipfile || ' ' || whereto ;
putlog "NOTE-Processing command " cmd ;
call system( cmd ) ;
run ;
options noxwait; %LET PASS =qwerty
; x unzip -o -P &PASS. "O:\Data\20220205
.zip" -d "O:\Data";
It may well be that you use a server-based SAS (through SAS Studio or Enterprise Guide) where the server does not yet have unzip installed.
Check with your SAS admins
Once you have code that works Then figure out how to create it with SAS code.
I recommend NOT using the X command. Instead just use the PIPE engine to run the command you have generated.
Running an external command via pipe goes like this:
filename oscmd pipe "unzip -o -P &PASS. O:\Data\20220205.zip -d O:\Data 2>&1";
data _null_;
infile oscmd;
input;
put _infile_;
run;
Since you do not have blanks in your path names, quotes are not needed there.
The "2>&1" reroutes stderr to stdout, so SAS can catch all eventual messages that come back from the external command.
Inspect the SAS log to see what happened.
It may well be that you use a server-based SAS (through SAS Studio or Enterprise Guide) where the server does not yet have unzip installed.
Check with your SAS admins
@shasank wrote:
Hi Kurt_Bremser,
Thank you!! I have cross checked and I am using SAS 9.4 installed on a windows machine. It is installed locally. I keep getting an error that UNZIP is not a built-in windows function. I will try to find if there is a similar function for windows.
So you appear stuck on the first step. What DOS/Windows command can you run to unzip a file on machine.
Try using Google to see if there is something available to you. If you have local system support ask them for help also.
https://www.google.com/search?q=unzipping+password+protected+zip+file+on+windows
Looks like a lot of users are using 7-Zip which does have a command line option you can get.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.