As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Output Delivery System Style Gallery

From sasCommunity
Jump to: navigation, search

Use this code to build a gallery of the ODS styles available on your system.

%let path=c:\temp\demo\; /* location of generated HTML files */

* Capture list of installed styles and load into SAS data set; data styles; set sashelp.vstyle; style = scan(style,2,'.'); * Link for table of contents; StyleLink = cats('<A HREF="',style,'.html">',style,'</A>'); nstyle + 1; call symput('nstyles',nstyle); run;
* Macro to generate the sample report using some particular style; %macro showstyle(style=,prevstyle=,nextstyle=) ;
ods listing close ; ods html file="&path.&style..html" style=&style ;
title "Style: &style"; * Navigation links in footnote will point to previous and next styles; footnote "<A HREF=&prevstyle..html>Previous</a>" '     ' "<A HREF=style-list.html>Menu</a>" '     ' "<A HREF=&nextstyle..html>Next</a>"; * Other appropriate PROC steps can be substituted; proc freq data=sashelp.class ; table sex*age ; run ;
title; footnote;
ods html close; ods listing;
%mend showstyle;
* Trigger the macro once for each style; data _null_; set styles; set styles(rename=(style=prevstyle) firstobs = &nstyles ) styles(rename=(style=prevstyle) obs = %eval(&nstyles-1) ) ; set styles(rename=(style=nextstyle) firstobs = 2 ) styles(rename=(style=nextstyle) obs = 1 ) ; * Multiple SET statements rotate the list in both directions for navigation; call execute(cats( '%showstyle(style=' , style , ',prevstyle=' , prevstyle , ',nextstyle=' , nextstyle , ')' ) ) ; run;
* Finally, generate table of contents; ods listing close; ods html file="&path.style-list.html";
title 'Style Gallery';
proc print data=styles noobs label; var StyleLink; label StyleLink = 'Style Name'; run;
title;
ods listing ; ods html close;

Richard DeVenezia has a more elaborate style gallery, not limited to the HTML destination.