Your SAS programs, embedded in web apps and elsewhere

Downloading Excel file from stored process web application

Reply
Contributor
Posts: 36

Downloading Excel file from stored process web application

Hi All,
Thanks in advance for your suggestions.

i was trying to download .xls file from stored process web application. i am able to save the file to a location on my system but to my surprise i am not getting any report data in it. Can any one help me solve the problem. i am using the code below


libname PNBD meta library="PNBD DB2 Library" metaout=data;
%GLOBAL _ODSOPTIONS _ODSDEST _ODSSTYLE _ODSSTYLESHEET ;
%macro output;
%GLOBAL OUTFMT1 _odsoptions ;
%let OUTFMT1 = &_ODSDEST;
%local OLD_HEADER OUTPUT_FORMAT;
%if (%upcase(&_ODSDEST) eq EXCEL) %then %do;
%let _ODSDEST = HTML;
%let OUTPUT_FORMAT = HTML;
%let OLD_HEADER =
%sysfunc(stpsrv_header(Content-type,application/vnd.ms-excel));
%end;
%else %if (%upcase(&_ODSDEST) eq PDF) %then %do;
%let OUTPUT_FORMAT = HTML;
%let OLD_HEADER =
%sysfunc(stpsrv_header(Content-type,application/pdf));
%let _odsoptions =startpage=NO ls=256 notoc; <---SAS LOG SHOWING SYNTAX ERROR BUT WONT EFFECT EXCEL OUTPUT.
%end;

%if (%qcmpres(&OUTPUT_FORMAT) eq )
%then %let OUTPUT_FORMAT=&_ODSDEST;
%STPBEGIN;
sas code
%MACRO NEW;
%IF &OUTFMT1. EQ EXCEL %THEN %DO;
ODS HTML FILE=_WEBOUT;
goptions reset=all;
options nobyline nonumber nodate ORIENTATION=LANDSCAPE ;

OPTIONS NOBYLINE;
PROC REPORT DATA=NEWFINAL CENTER MISSING NOWINDOWS split="!;
ODS HTML CLOSE;
%END;
%ELSE %IF &OUTFMT1. EQ PDF %THEN %DO;
ods pdf file=_webout;
PROC REPORT DATA=NEWFINAL CENTER MISSING NOWINDOWS split="!;

ods pdf close;
%end;
%MEND NEW;
%NEW
%STPEND;
%mend output;
%output;
SAS Employee
Posts: 285

Re: Downloading Excel file from stored process web application

Try to get something simple to work, and then incrementally add more complex logic:

[pre]%let RV=%sysfunc(appsrv_header(Content-type,application/vnd.ms-excel));
%let _ODSDEST=html;
%STPBEGIN;
proc print data=sashelp.class; run; quit;
%STPEND;[/pre]

Vince DelGobbo
SAS R&D
Contributor
Posts: 36

Re: Downloading Excel file from stored process web application

Thanks vince today i tried with the code and i made some changes like i removed file=_webout; from ods html file =_webout;. it is working. Thank you for your suggestion.
Ask a Question
Discussion stats
  • 2 replies
  • 625 views
  • 0 likes
  • 2 in conversation