BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
I have a dataset "aaa"

ID Vi Name
101 1 XXXXXX
101 2 XXXXXX
102 1 YYYYY
102 2 YYYYY
103 1 ZZZZZZ
103 2 ZZZZZZ

I use the following code for getting this data into Excel .And the output file looks good with both the proc's being separated well in the excel.

OPTIONS orientation=landscape ;
ODS LISTING CLOSE;
ODS HTML FILE='E:\Test.xls' style=sasweb;run;
footnote h=10pt f=TimesRoman j=l "%sysfunc(today(),mmddyy10.)";
options nodate center;
proc print DATA=aaa(where=( VI_=1));
title 'Data with V1';
run;

proc print DATA=aaa(where =(VI_=2)) ;
title 'Data with V2';
run;
ods HTML close;

Now my goal is do something similar using _webout and generate .xls file on the web.

I normally use the code below in my ODS statement if I had to generate reports for end users on the web.

ods pdf body=_webout style=sasweb;

proc print data=aaa noobs label ;
TITLE underlin=1 color=Red justify=center" My Report";
footnote ' ';
run;
ods PDF CLOSE;

But since I'm adding more variables now the end users wanted to have the report in excel.


Appreciate you help.

Regards,
Addy
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
Are you using SAS/IntrNet or a stored process? Basically, when you use _webout, you are using a pipeline that exists between a server and a client browser. That pipeline "knows" when you send regular content types like HTML and in some instances, TXT files or PDF files to the browser. And the browser "knows" how to deal with regular content types like HTML, TXT or PDF.

However with either SAS/IntrNet Application Dispatcher programs or Stored Processes, if you are sending non-HTML or you want to launch an application OTHER THAN the browser for rendering the file, you must send a content-type header down the pipeline, so the browser knows to launch a helper program for rendering.

In your instance, if you are generating ODS HTML, but you want Excel to launch instead of the browser, then you have to control the content-type header by using either the APPSRV_HEADER function (SAS/IntrNet) or the STPSRV_HEADER function (Stored Process).

An example of using APPSRV_HEADER can be found here:
http://support.sas.com/kb/23/650.html

and STPSRV_HEADER #6 here:
http://support.sas.com/kb/12/994.html

cynthia
deleted_user
Not applicable
Neat Explanation. My code is now working.

Thanks..

Appreciate your Help.

Regards,
Eddie

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 1115 views
  • 0 likes
  • 2 in conversation