i am using this library "LibABC" which contains many datasets in an unix server. some datasets in this library are zipped (for ex- file1.sas7bdat.Z) and some are unzipped(file2.sas7bdat).
i am not able to access those zipped datasets from the server through my sas code.
kindly help me how can i resolve this issue.
if there is any code in sas to access zipped files from unix server share it with me
.Z is the extension used by the compress command, not ZIP or GZIP.
Use the uncompress command to expand the file and then SAS will be able to read it.
Editor's note: included some additional details from SAS support doc:
Here's a SAS Note with an example (which assumes the data was compressed via SAS and the compress command). It relies on FILENAME PIPE, which will require privileges to run shell commands (XCMD):
Creating the compressed data set: http://support.sas.com/kb/25/199.html
Reading the compressed data set: http://support.sas.com/kb/25/214.html
Sanjeev,
i am not allowed to install any additional tools or software , the pdf u wanted me to refer suggests installation of some tools. So can you suggest if there is some piece of code to unzip files in sas.
I had mixed experiences with SASZIPAM in the past. New with SAS 9.4 is a zip engine available (filename myfile zip ....).
I've done some "Googling" as I didn't know what the file extension .Z stands for and found the following File Extension Z « Avanquest
It appears that GZIP is eventually able to deal with it. Ideally the person who created the .Z file tells you what tool they've used and you're using the same to un-compress the data sets.
The exact syntax you need to use - eg. for GZIP - is something you need to look up, but the general principle is as described under the link posted (http://www2.sas.com/proceedings/sugi31/155-31.pdf)
.
.Z is the extension used by the compress command, not ZIP or GZIP.
Use the uncompress command to expand the file and then SAS will be able to read it.
Editor's note: included some additional details from SAS support doc:
Here's a SAS Note with an example (which assumes the data was compressed via SAS and the compress command). It relies on FILENAME PIPE, which will require privileges to run shell commands (XCMD):
Creating the compressed data set: http://support.sas.com/kb/25/199.html
Reading the compressed data set: http://support.sas.com/kb/25/214.html
thanks all
If this is resolved for you then could you please mark this question as answered?
I searched for the method for our purpose and the best answer I got for a dumb programer like me is from a SAS paper, Paper 057-2012
A SAS® Macro to Zip and Unzip Files in MS Windows without Additional External Data Archiving Software, Kai Koo, Abbott Laboratories, Santa Clara, CA
The paper is attached if you don't want to search it online.
I can skip the concept of this method and just use its macro program. It becomes extremely easy and useful. Hope you like it.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.