Date: Fri, 25 May 2001 09:08:23 +1200
Reply-To: Geoff Grimwood <geoff@DATAMINE.CO.NZ>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Geoff Grimwood <geoff@DATAMINE.CO.NZ>
Organization: Datamine Limited
Subject: Re: Zip excel files from SAS
Content-Type: text/plain; charset=us-ascii
My 2 cents.
I prefer using the pipe device/engine thing because the irritating DOS
box doesn't make an appearance. The PKZIPC exectuable needs to be in the
PATH. I can't remember where I got the executable from but it is more or
less the same as PKZIP.
%zip(d:\temp,fred,txt) will create d:\temp\fred.zip containing
d:\temp\fred.txt. I'm too lazy to have one parameter and then take it
apart to get the necessary components.
Beware the quotes!
%macro zip(dir, filename, ext);
%let cmd2=%str(pkzipc -silent -add %"&dir\%trim(&filename).zip%"
%"&dir\%trim(&filename).%trim(&EXT)%");
filename foo pipe "&cmd2";
data _null_;
file foo;
run;
%mend;
Regards
Geoff
Richard DeVenezia wrote:
>
> David,
>
> You will also have to use double quotes around the filenames since they
> appear to contain embedded spaces.
> Such as
>
> x wzzip -a "c:\temp\b b\abcd" "c:\temp\a a";
>
> if you insist on quoting the command (not necessary but allowed) you need
> more quotes (two consecutive quotation marks (single or double) collapses to
> a single quotation mark of the same type, when within a quoted string that
> starts with the same type of quotation mark)
>
> x "wzzip -a ""c:\temp\b b\abcd"" ""c:\temp\a a""";
>
> --
> Richard DeVenezia - SAS Macros and AF Tools
> http://www.devenezia.com
>
> "David Simmons" <DavidSi@KINKOS.COM> wrote in message
> news:sb0ced35.019@kinkos.com...
> > I'm trying to use winzip to zip some excel files from SAS using the X
> statement as discussed below.
> >
> > One thing you can try is to have SAS shell out
> to DOS using an X
> > statement. You can then use command lines
> statement supported by
> > WINZIP 7 to create the zip file. For example,
> the SAS statement
> >
> > X "WZZIP -a c:\test\myzip
> c:\test\myfile.xls";
> >
> > will zip up the Excel file into a file named
> myzip.zip. A couple of
> > key issues. To use Winzip commands, the
> WinZip Command Line Support
> > Add-on (which the last time I checked was Beta
> software) must be
> > installed onto WinZip 7.0. I don't think
> version WinZip 6 supports
> > command lines. Both can be downloaded from
> the WinZip website. Also,
> > for the command to work as shown above, the
> winzip folder location
> > must be in your path statement (i.e. in your
> autoexec.bat file). All
> > this info is well documented in the Command
> Line Support
> > documentation.
> >
> > Mike Mumma
> > Westat
> >
> > When I issue the command below, a black dos box blinks on the screen
> > and that is all. I have added d:\program files\winzip to my autoexec
> file. any ideas would be appreciated.
> >
> > X "winzip32 -a e:\loss prevention\April2001\ops10b e:\loss
> prevention\April2001\ops10b.xls";
> >
> >
> > David H. Simmons
|