Date: Thu, 30 Mar 2000 09:40:31 -0600
Reply-To: "Dwight Eggers (EUS)" <EUSDEE1@AM1.ERICSSON.SE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Dwight Eggers (EUS)" <EUSDEE1@AM1.ERICSSON.SE>
Subject: Re: Intrnet: copy binary with mime-type prefix
Content-Type: text/plain; charset="iso-8859-1"
I received some useful help from Howard Wright for doing a binary copy
within a data step. Since he did not post it to the news group, I am
sharing a solution to my original query that appears to be working.
Howard's solution involves the most elementary form of the INPUT statement
-- without any variable specifications -- and the _INFILE_ keyword in the
PUT statement.
The macro that I developed for passing a binary file, with a mime-type
specification appended as a header, to a client application from an Intrnet
application server follows. My remaining concern is whether the MAXSIZE
specification is sufficient to handle the general situations.
Dwight Eggers
%macro bincopy (mimetype, filename, outfile=_webout, maxsize=8192);
%* Download a binary file to the client through the browser with the ;
%* appropriate mime-type specification to allow the file to be opened ;
%* in the target application. ;
%* Needed parameters are the following: ;
%* mimetype -- Mime type, for example: application/vnd.ms-excel;
%* filename -- name of file on application server.;
data _null_;
file &outfile lrecl=&maxsize;
infile "&filename" lrecl=&maxsize ;
if _n_=1 then do;
put "Content-type: &mimetype" ;
put;
end;
input;
put _infile_;
run;
%mend bincopy;