Pages

Friday, July 26, 2013

Widgets

Reading Text from a zip file


There is a currently undocumented (and unsupported) filename engine that can be used to read text from compressed ZIP files directly. You use it by specifying the engine "SASZIPAM" on a filename statement that points to the zip file.

When referring to it you specify the file within it that you wish to read. The contents of the compressed file are written to your SAS log.

In this example, the zip file "STT.zip" contains several text files. I want to read "sweep.txt" and therefore specify "zipfile(sweep.txt)", where "zipfile" is the fileref.
filename zipfile saszipam 'C:\temp\STT.zip';

data _null_;
infile zipfile(sweep.txt);
input;
put _infile_;
run;

No comments:

Post a Comment