Wednesday, October 18, 2006

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;

6 Comments:

At 1:54 PM, Anonymous Anonymous said...

Linda,

Have you ever seen the following error while using the SASZIP AM dll:

ERROR: Read Access Violation In Task [ DATASTEP )
ERROR: Read Access Violation In Task [ DATASTEP )
ERROR: Read Access Violation In Task [ DATASTEP )
Exception occurred at (62A22BE2)
Exception occurred at (62A22BE2)
Exception occurred at (62A22BE2)
Task Traceback
Task Traceback
Task Traceback
Address Frame (DBGHELP API Version 4.0 rev 5)
Address Frame (DBGHELP API Version 4.0 rev 5)
Address Frame (DBGHELP API Version 4.0 rev 5)
62A22BE2 04BDFC1C saszipam:mcn_main+0x1BE2
62A22BE2 04BDFC1C saszipam:mcn_main+0x1BE2
62A22BE2 04BDFC1C saszipam:mcn_main+0x1BE2
62A22F6F 04BDFCE8 saszipam:mcn_main+0x1F6F
62A22F6F 04BDFCE8 saszipam:mcn_main+0x1F6F
62A22F6F 04BDFCE8 saszipam:mcn_main+0x1F6F
67990156 04BDFD24 sasxkern:mcn_main+0x3F156
67990156 04BDFD24 sasxkern:mcn_main+0x3F156
67990156 04BDFD24 sasxkern:mcn_main+0x3F156
6723F482 04BDFED0 sasdsx:mcn_main+0xE482
6723F482 04BDFED0 sasdsx:mcn_main+0xE482
6723F482 04BDFED0 sasdsx:mcn_main+0xE482
6723EE6B 04BDFEFC sasdsx:mcn_main+0xDE6B
6723EE6B 04BDFEFC sasdsx:mcn_main+0xDE6B
6723EE6B 04BDFEFC sasdsx:mcn_main+0xDE6B
6723142A 04BDFF40 sasdsx:mcn_main+0x42A
6723142A 04BDFF40 sasdsx:mcn_main+0x42A
6723142A 04BDFF40 sasdsx:mcn_main+0x42A
673115B0 04BDFF8C sasds:mcn_main+0x5B0
673115B0 04BDFF8C sasds:mcn_main+0x5B0
673115B0 04BDFF8C sasds:mcn_main+0x5B0
02682B02 04BDFFA4 sashost:Main+0xBE72
02682B02 04BDFFA4 sashost:Main+0xBE72
02682B02 04BDFFA4 sashost:Main+0xBE72
02686C20 04BDFFB8 sashost:Main+0xFF90
02686C20 04BDFFB8 sashost:Main+0xFF90
02686C20 04BDFFB8 sashost:Main+0xFF90
7D4DFE21 04BDFFEC kernel32:FlsSetValue+0x136
7D4DFE21 04BDFFEC kernel32:FlsSetValue+0x136
7D4DFE21 04BDFFEC kernel32:FlsSetValue+0x136

 
At 1:17 PM, Anonymous Anonymous said...

Thanks, Linda. It works!

 
At 7:10 AM, Anonymous Anonymous said...

I am facing same error. can u please let me know how i can run it successfully?

 
At 8:22 AM, Anonymous Anonymous said...

I am still getting an error

ERROR: Read Access Violation In Task [ DATASTEP )
ERROR: Read Access Violation In Task [ DATASTEP )
ERROR: Read Access Violation In Task [ DATASTEP )
Exception occurred at (62A22BE2)
Exception occurred at (62A22BE2)
Exception occurred at (62A22BE2)
Task Traceback
Task Traceback
Task Traceback
Address Frame (DBGHELP API Version 4.0 rev 5)
Address Frame (DBGHELP API Version 4.0 rev 5)
Address Frame (DBGHELP API Version 4.0 rev 5)
62A22BE2 04BDFC1C saszipam:mcn_main+0x1BE2
62A22BE2 04BDFC1C saszipam:mcn_main+0x1BE2
62A22BE2 04BDFC1C saszipam:mcn_main+0x1BE2
62A22F6F 04BDFCE8 saszipam:mcn_main+0x1F6F
62A22F6F 04BDFCE8 saszipam:mcn_main+0x1F6F
62A22F6F 04BDFCE8 saszipam:mcn_main+0x1F6F
67990156 04BDFD24 sasxkern:mcn_main+0x3F156
67990156 04BDFD24 sasxkern:mcn_main+0x3F156
67990156 04BDFD24 sasxkern:mcn_main+0x3F156
6723F482 04BDFED0 sasdsx:mcn_main+0xE482
6723F482 04BDFED0 sasdsx:mcn_main+0xE482
6723F482 04BDFED0 sasdsx:mcn_main+0xE482
6723EE6B 04BDFEFC sasdsx:mcn_main+0xDE6B
6723EE6B 04BDFEFC sasdsx:mcn_main+0xDE6B
6723EE6B 04BDFEFC sasdsx:mcn_main+0xDE6B
6723142A 04BDFF40 sasdsx:mcn_main+0x42A
6723142A 04BDFF40 sasdsx:mcn_main+0x42A
6723142A 04BDFF40 sasdsx:mcn_main+0x42A
673115B0 04BDFF8C sasds:mcn_main+0x5B0
673115B0 04BDFF8C sasds:mcn_main+0x5B0
673115B0 04BDFF8C sasds:mcn_main+0x5B0
02682B02 04BDFFA4 sashost:Main+0xBE72
02682B02 04BDFFA4 sashost:Main+0xBE72
02682B02 04BDFFA4 sashost:Main+0xBE72
02686C20 04BDFFB8 sashost:Main+0xFF90
02686C20 04BDFFB8 sashost:Main+0xFF90
02686C20 04BDFFB8 sashost:Main+0xFF90
7D4DFE21 04BDFFEC kernel32:FlsSetValue+0x136
7D4DFE21 04BDFFEC kernel32:FlsSetValue+0x136
7D4DFE21 04BDFFEC kernel32:FlsSetValue+0x136

Please help me out!! I am trying to read a zip file in SAS using Linda's command

 
At 9:31 AM, Blogger Alex said...

I like the music. I often download hundreds tracks from the Internet,but yesterday I couldn't listen a track inside zip archive. I was bitterly disappeared,but fortunately my friend is a DJ and advised me - compressed file corrupted zip. I tried this tool and it astonihed me. Because the software restored my track very fast and without money as far as I remember. Moreover my friend was quite right with regard to the tool.

 
At 12:14 PM, Anonymous Anonymous said...

Linda, how do you capture the list of members in a zipped file to pass the member name so that ALL of the files can be read using the code -

infile in(&filename);

where &filename is the member name

 

Post a Comment

<< Home