Showing Your Style

From sasCommunity
Jump to: navigation, search
 
%macro showstyles;
data _null_;
   set sashelp.vstyle(keep=style) end=eof;
   sname= scan(style,-1,'.');
   if sname ne 'Style';
   i+1;
   call symputx(catt('style',i),sname);
   if eof then call symputx('stylecnt',i);
   run;
ods pdf file="ShowStyles.pdf";
%do i = 1 %to &stylecnt;
ods pdf style=&&style&i;
ods proclabel="&&style&i";
title1 "Using style &&style&i";
proc print data=sashelp.class;
run;
%end;
ods pdf close;
%mend showstyles;
%showstyles

There are so many ODS styles available. Have you ever wanted to see how your report will look when using a different style? Trying them all is a bit of a pain. Here is a simple program to cycle through all the registered styles, including your customized styles, by showing a simple PROC PRINT for each style.

The SAS View SASHELP.VSTYLES is used to gather the names of the styles, which are then placed in a list of macro variables (&&SYTLE&i).

A macro %DO loop is used to cycle through the list of styles printing a small report for each.

To fit your specific needs the report is easily changed as is the ODS destination.