- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I want to unzip a file in windows sas. Is it possible?
abc_clinc_20160204123456.gz
File might be txt,csv,.dat anything.
output should be like abc_clinc_20160204123456.txt/csv/dat
I tried using below commands. but unable to do.
x "gunzip \path\abc_clinc_20160204123456.gz";
%sysexec gunzip "\path\abc_clinc_20160204123456.gz";
I don't want to use unix.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Attach an example .gz file, if at all possible. Anybody who succeeds to unzip it in Windows SAS can tell you how he/she did it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You have a few options.
1. If you have SAS 9.4 and want to read from file you don't need to unzip file.
2. Use OS/Windows command to use win zip or 7zip to zip/unzip file.
Here re how to zip files using SAS and 7zip.
https://gist.github.com/statgeek/9602105
SAS blog on file name ZIP method
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
So just unzipping is not possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Yes it is.
The example above zips, but you could similarily unzip if you found the correct OS command. Assuming your allowed to pass OS commands. If you're not, then no, you can't unzip.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
All the programs that can do a zip from the commandline also have options to unzip. Just find the correct option in the documentation for your zipping utility.
A quick compendium of the commandline utility for the 7zip package can be found here: http://www.dotnetperls.com/7-zip-examples
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can I ask what you mean by this line:
"I don't want to use unix."
Is your SAS installed on Windows or Unix? If you are on Windows, then you don't need to use Unix, simply put Winzip or your favourite unzip package on your machine, then ue X command to pass through to the OS the necessary string to run it - assumes Winzip is installed to C:\Winzip:
X ' "c:\Winzip\Winzip.exe" "<path to your file><filename>.zip" "<path to output location>"';
This calls the program in Winzip with the two parameters file and output location. If your installed on Unix, then you need to use a Unix equivalent. SAS does not provide Third Party unpack tools (as yet anyways).
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hey RW9,
Thanks. But for unzipping there is seperate exe file wzunzip.exe.
for zipping wzzip.exe
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@pessi It depends, you can use various applications so the exact command can vary.