SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 20784: Tip for downloading an existing binary file when running the SAS® Stored Process Server

DetailsAboutRate It

It is possible to download an existing binary file (or text file) when you are running a SAS® Stored Process request with the SAS® Stored Process Server by following the steps below.

  1. Create a SAS Stored Process that contains the SAS code that is shown at the bottom of this SAS Note.
  2. Modify the FILENAME "IN" statement by specifying the name of the file that you want to download.
  3. The example below downloads a PDF file. If you want to download another type of file, then you will need to specify different HTTP headers. For more information about HTTP Header records see HTTP Headers in the SAS® 9.1.3 Integration Technologies Developer's Guide.
  4. When you define the SAS Stored Process in your SAS® Metadata Repository, specify an "Output" type as "Streaming".

If you want to download a file that is created dynamically when you are running a SAS Stored Process, then see SAS Note 12994 .

Note: It also possible to download existing files if you have SAS/IntrNet® installed (in addition to SAS® Business Intelligence software) by using the FILESRV program. For more information, refer to FILESRV Program documentation.

----------------------------------------------------------------

 /* This example downloads an existing PDF file when   */
 /* running a stored process.                          */

*ProcessBody;

  /* Modify the following statement to specify the file */
  /* that you want to download.                         */

 filename in "c:\your_directory\test.pdf";

   /* Specify HTTP header records */
 data _null_;
   rc = stpsrv_header('Content-type','application/pdf');
   rc =
   stpsrv_header('Content-disposition','attachment; filename=temp.pdf');
 run;

 data _null_;
    length data $1;
    INFILE  in  recfm=n;
    file _webout  recfm=n mod;
    input data  $char1. @@;
    put data $char1. @@;
 run;
 


Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS Integration TechnologiesMicrosoft Windows XP Professional9.1 TS1M3
Microsoft Windows XP 64-bit Edition9.1 TS1M3
Microsoft Windows Server 2003 Standard Edition9.1 TS1M3
Microsoft® Windows® for 64-Bit Itanium-based Systems9.1 TS1M3
Microsoft Windows Server 2003 Datacenter Edition9.1 TS1M3
Microsoft Windows Server 2003 Enterprise Edition9.1 TS1M3
Microsoft Windows 2000 Server9.1 TS1M3
Microsoft Windows 2000 Datacenter Server9.1 TS1M3
Microsoft Windows 2000 Professional9.1 TS1M3
Microsoft Windows 2000 Advanced Server9.1 TS1M3
64-bit Enabled Solaris9.1 TS1M3
HP-UX IPF9.1 TS1M3
Linux9.1 TS1M3
Linux on Itanium9.1 TS1M3
64-bit Enabled HP-UX9.1 TS1M3
OpenVMS Alpha9.1 TS1M3
64-bit Enabled AIX9.1 TS1M3
Tru64 UNIX9.1 TS1M3
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.