DATA Step, Macro, Functions and more

Reading gzip files

Accepted Solution Solved
Reply
N/A
Posts: 0
Accepted Solution

Reading gzip files

My turn to ask something.

Can SAS read a gzipped file directly?
I mean with an infile - input statement pair, not through the set command.

We have a number of text files that are zipped up that we need to be able to read.
The files used to go to a Unix server where cron'd shell scripts controlled the files being uncompressed and compressed, to expose the most recent two days.
Now, the files are being stored on a Windows server, controlled by different people and processes. So, it would be best for us to use SAS to grab the file directly, and read it from the compressed/gzipped form.

Humans are able to read the files directly through WinZIP, which acts as a intermediary between the zipped file and notepad or wordpad.

I'd ask tech support, but I'd rather not wait a week for someone to get back to me.

Accepted Solutions
Solution
a month ago
Regular Contributor
Posts: 213

Re: Reading gzip files

[ Edited ]
Posted in reply to deleted_user

I see this is an old thread, but it appeared early in my search results. So I just wanted to share a 2017 blog post, Reading and writing GZIP files with SAS by @ChrisHemedinger that answers the question.

 

...and I want to respond to the jab at tech support taking a week: whenever I've submitted a track with SAS Tech Support, they've replied within 24 hours (not including weekends and holidays), as stated in their automated ticket email. I've been very happy with how responsive they've been, even if there's a little back-and-forth needed.

View solution in original post


All Replies
N/A
Posts: 0

Re: Reading gzip files

Posted in reply to deleted_user
read through a filename pipe.
See the sample I found among Support.sas.com, knowledge base, Samples and Notes
http://support.sas.com/kb/25/206.html
entitled
25206 - SAMPLE: Create/Read a Unix compressed file from SAS
N/A
Posts: 0

Re: Reading gzip files

Posted in reply to deleted_user
Ahh, piping.
Never used it before.
Now we have a reason to.
Thanks Pete.

I was hoping that SAS/ACCESS for PC files would allow
[pre]
FILENAME my_gzip ZIP ".... .gz";
[/pre]
so that we could then do something like
[pre]
infile my_gzip(zipped_file);
[/pre]

But no.
Oh well.

Dreaming ...
Solution
a month ago
Regular Contributor
Posts: 213

Re: Reading gzip files

[ Edited ]
Posted in reply to deleted_user

I see this is an old thread, but it appeared early in my search results. So I just wanted to share a 2017 blog post, Reading and writing GZIP files with SAS by @ChrisHemedinger that answers the question.

 

...and I want to respond to the jab at tech support taking a week: whenever I've submitted a track with SAS Tech Support, they've replied within 24 hours (not including weekends and holidays), as stated in their automated ticket email. I've been very happy with how responsive they've been, even if there's a little back-and-forth needed.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 2738 views
  • 1 like
  • 2 in conversation