- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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";
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- where SAS is installed (local or remote)
- which operating system (if remote)
- which zip/unzip program to use
- which path to use (if remote)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Figure out the command that works from the DOS/CMD window prompt.
- Make sure it runs on the machine where SAS is running when logged in as the user that is running the SAS code. For example if you are using SAS/Studio or Enterprise Guide to submit your SAS code then it might be running on a different machine than the one you are using to run your front end tool. That machine might not even be running Windows, or have the WinZip.exe command on it, or even have access to the O drive where your file is.
- Try running a static version of the code.
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
*
'unzip' is not recognized as an internal or external command,
operable program or batch file.
*
Do I have to install anything before I run this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- where SAS is installed (local or remote)
- which operating system (if remote)
- which zip/unzip program to use
- which path to use (if remote)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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.