LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 27 Sep 2006 16:35:31 +1000
Reply-To:     Richard Hockey <r.hockey@SPH.UQ.EDU.AU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Richard Hockey <r.hockey@SPH.UQ.EDU.AU>
Subject:      Re: Unzip a file
Comments: To: LouisBB <nospam@HCCNET.NL>
Content-Type: text/plain; charset="us-ascii"

There is some information on the SASzipam engine here: http://www2.sas.com/proceedings/sugi31/155-31.pdf

Richard

> -----Original Message----- > From: LouisBB [mailto:nospam@HCCNET.NL] > Sent: Wednesday, 27 September 2006 2:39 PM > Subject: Re: Unzip a file > > Thanks David, > > The saszipam engine was the one I was looking for. I just > couldn't find the reference yesterday, it being undocumented. ;-) > > LouisBB. > > "David L Cassell" <davidlcassell@MSN.COM> wrote in message > news:BAY103-F31D3E7392A179856BDF70AB0250@phx.gbl... > > LouisBB replied: > >> > >>Dear Kiran, > >> > >>Is this example from > >>http://support.sas.com/ctx/samples/index.jsp?sid=1584&tab=code what > >>you are looking for? > >> > >>LouisBB. > >> > >> > >>/******************************************************/ > >>/* The syntax parameters for wzunzip are: */ > >>/* */ > >>/* specify the location of the downloaded add-on */ > >>/* -o = overwrite existing file */ > >>/* -c = display contents of file to screen */ > >>/* name of zip file */ > >>/* name of file inside of zip to be read */ > >>/* */ > >>/* Note the contents of the zipped file are read */ > >>/* directly, no extraction is performed. */ > >>/******************************************************/ > >> > >>filename foo pipe '"c:\program files\winzip\wzunzip.exe" > >> -o -c > >> c:\sample01584_1_data.zip > >> testfile.txt'; > >> > >>/* The zip file, sample01584_1_data.zip, is flat file created */ > >>/* from PROC Export and SASHELP.CLASS. */ > >> > >>data test; > >> /* Use FIRSTOBS= to skip the first 8 records related to zip */ > >> /* information, and the 9th record which contains a header */ > >> /* record of variable names from SASHELP.CLASS. */ > >> infile foo firstobs=10 truncover dsd; > >> input name :$9. sex :$1. age height weight; run; > >> > >>proc print; > >>run; > >> > >> > >> > >>"Kiran Nallapeta" <k_nallapeta@HOTMAIL.COM> wrote in message > >>news:BAY7-F23E031625D66559833A1A995250@phx.gbl... > >> > Hi everyone, > >> > > >> > Is there a way we can unzip a flat file in SAS directly (without > >> > using operating system commands with X function). I want > to read a > >> > flat file after unzipping it. > >> > > >> > Thanking you and Best Regards, > >> > Kiran > > > > In addition to Louis' suggestion, you could also use the > > **undocumented** filename engine SASZIPAM . Here's what > Jack Hamilton > > wrote, roughly three years ago: > > > > 88888888888888888888888888888888888888888888888888 > > > > Here's an undocumented, unsupported approach. It reads "readme.txt" > > from "sample.zip". > > > > ===== > > NOTE: SAS (r) Proprietary Software Release 8.2 (TS2M0) > > NOTE: This session is executing on the OSF1 V5.1 platform. > > > > 1 filename x saszipam '~/sample.zip'; > > 2 > > 3 data _null_; > > 4 > > 5 infile x(readme.txt); > > 6 input; > > 7 put _infile_; > > 8 > > 9 run; > > > > NOTE: The infile library X is: > > Stream=~/sample.zip > > > > NOTE: The infile X(readme.txt) is: > > File Name=readme.txt, > > Compressed Size=45,Uncompressed Size=47, > > Compression Level=-1,Clear Text=Yes > > > > this is a small sample file in a ZIP archive. > > NOTE: A total of 2 records were read from the infile library X. > > NOTE: 2 records were read from the infile X(readme.txt). > > NOTE: DATA statement used: > > real time 0.14 seconds > > cpu time 0.06 seconds > > ===== > > > > Also works under Windows. > > > > I repeat: undocumented, unsupported. > > > > 8888888888888888888888888888888888888888888888888 > > > > In addition, bear in mind that Windows does not really pipe the > > unzipped file the way that unix does. It creates a > temporary file of > > the fully-unzipped file, and reads from that. If you are > trying to do > > this in Windows and you wanted to avoid filling up your disk drive > > with some ginormous file, you are out of luck. > > the file will still appear on your disk, just tucked away in a temp > > directory. > > > > HTH, > > David > > -- > > David L. Cassell > > mathematical statistician > > Design Pathways > > 3115 NW Norwood Pl. > > Corvallis OR 97330 > > > > _________________________________________________________________ > > Get today's hot entertainment gossip > > http://movies.msn.com/movies/hotgossip >


Back to: Top of message | Previous page | Main SAS-L page