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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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