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;

7 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 10:43 AM, Blogger Alex said...

Inside zip files there are many information and sometimes this info are corrupted,for solve this problem and similar issues advise to use-zip damaged,tool is free as is known,it has so many facilities,program can be also used, when a removable media, where an archive was located, is physically damaged and WinZip archiver cannot extract your files from it,program is a must have for all users, who often work with Zip archives, it will help you and your friends anytime,can work under all versions of Windows operating system, no need to take care about compatibility problems, Windows Vista is also supported,open Zip archives, analyze it for errors and look through the list of files, that can be recovered,repair damage zip file uses several intellectual algorithms to extract your data and compare the results.

 
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