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

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

View SAS Template Styles Quick as a Snap

From sasCommunity
Jump to: navigation, search

I have been using SAS for many years and it has always been cumbersome to find the "best" SAS template style for displaying tables generated using many SAS procedures such as PROC PRINT, PROC FREQ, or PROC REPORT or many others. In the past I ran a "snip-it" of SAS code to get a list of SAS template styles, and then one by one I experimented with each style to see how the appearance of my output changed. However the list is very lengthly and after a dozen or so I gave up. THE SOLUTION HAS ARRIVED. I found this short SAS program in a SAS Technical Note 36900: "Instructions for viewing all of the style templates that are shipped with SAS." which generates a "frame.html" to let you instantly view each style. What a time saver! Run the SAS code below and then open the file "frame.html." This is great!

%LET path= \\sbpwsas2\data\HID_PROJECTS\HOC\CCORP_Projects\SpecialProjects\Springborn_Pgm_Updates\Tagsets_ExcelXP\ShowStyleTemplates;

%macro showstyle(style);

ods html path="&path"(url=none) file="&style..html" 
    contents=temp(notop nobot) frame="frame.html" style=&style;
ods proclabel "Style name";

proc print data=sashelp.class contents="Styles.&style";

ods html close;


ods path work.templat(update) sashelp.tmplmst(read);

filename temp "&path\contents.html" mod;
ods html path="&path"(url=none) contents=temp(nobot);
ods html exclude stats;

ods output stats=styles(where=(type ne "Dir"));

proc template;
   list styles;

proc sort data=styles;
   by path;

data one;
   set styles;
   by path;
   if first.path then
      call execute('%showstyle('||path||')');

data _null_;
   file temp;
   put "</body>";
   put "</html>";

ods path reset;