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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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