02-03-2016 03:32 PM
I want to unzip a file in windows sas. Is it possible?
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.
02-03-2016 03:42 PM
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.
02-03-2016 04:16 PM
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.
SAS blog on file name ZIP method
02-03-2016 04:29 PM
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.
02-04-2016 02:49 AM
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
02-04-2016 04:28 AM
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).