BookmarkSubscribeRSS Feed
hari1109
Fluorite | Level 6
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;
2 REPLIES 2
Vince_SAS
Rhodochrosite | Level 12
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
hari1109
Fluorite | Level 6
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.

SAS Innovate 2025: Register Today!

 

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2416 views
  • 0 likes
  • 2 in conversation