The SAS Output Delivery System and reporting techniques

data _null_ and RTF

Reply
N/A
Posts: 0

data _null_ and RTF

How can I produce report written in data _null_ to go to Word isung ODS RTF. Is there any way I can do this. The summary report is custom made.
Thanks
SAS Super FREQ
Posts: 8,740

Re: data _null_ and RTF

Hi!
The advent of ODS brought changes to data _null_ syntax for custom tabular reports.

With "classic" DATA _NULL_ reporting statements, you could create custom tabular and custom "free-format" reports using FILE PRINT and PUT statements.

With ODS and DATA _NULL_ you can generate custom tabular reports. For custom "free-format" reports you have to wait for the capability described here:
http://www2.sas.com/proceedings/sugi28/022-28.pdf (Although, I understand that what's cooking now may be a bit different than what's described in the paper. But you'll get the general idea.)

For more information about DATA _NULL_ and custom table templates, I did a SUGI paper on this subject a few years ago and you can download the paper here:
http://www2.sas.com/proceedings/sugi30/088-30.pdf

The Tech Support FAQ for ODS also has some good examples.
http://support.sas.com/techsup/technote/ts664.html
http://ftp.sas.com/techsup/download/v7papers/ODS_DATA.pdf
http://support.sas.com/faq/036/FAQ03611.html
http://support.sas.com/rnd/base/topics/templateFAQ/Template.html (follow the links for ODS and the DATA Step)

Good luck! Here's a program that shows the basic syntax.

cynthia
[pre]
title;
footnote;
ods noproctitle;
ods listing;

** make some test data;
data work.sales;
set sashelp.shoes(rename=(sales=sales1));
where product contains 'Dress';
year1=2003;
sales2=sales1*1.05;
year2=year1+1;
sales3=sales2*1.05;
year3=year2+1;
run;

proc means data=work.sales noprint nway;
class Region;
var sales1 sales2 sales3;
id year1 year2 year3;
output out=work.salessummary
sum=sum_sales1 sum_sales2 sum_sales3
mean=mean_sales1 mean_sales2 mean_sales3;
run;

** this shows the "new" syntax for data _null_ and ODS;
** there is more you can do, but this is the basics.;
** With custom table templates added into the mix, ;
** you can do more to create custom tabular reports;
ods listing close;
ods rtf file='c:\temp\only_year3.rtf';
ods html file='c:\temp\only_year3.html';
ods pdf file='c:\temp\only_year3.pdf';
title 'Only Year 3 Dress Shoes Projected Sales';
data _null_;
set work.salessummary;
file print
ods=(variables=(Region
year3 sum_sales3 mean_sales3));
put _ods_;
run;
ods _all_ close;

ods rtf file='c:\temp\year1_year3.rtf';
ods html file='c:\temp\year1_year3.html';
ods pdf file='c:\temp\year1_year3.pdf';
title 'Compare Year 1 (Actual) and Year 3 (Projected)';
data _null_;
set work.salessummary;
file print
ods=(variables=(Region
year1 sum_sales1 mean_sales1
year3 sum_sales3 mean_sales3));
put _ods_;
run;
ods _all_ close;

ods listing;
[/pre]
Ask a Question
Discussion stats
  • 1 reply
  • 116 views
  • 0 likes
  • 2 in conversation