Creating Shared Templates

When creating templates (especially with dynamics that generalize the usefulness of the template), you typically want to enable several people to create graphs from the template. To enable access to templates, you must store the "public" templates in a directory that is accessible to others. PROC TEMPLATE can store templates in specified SAS libraries and within specific item stores. By default, templates are stored in SASUSER.TEMPLAT , but another library.itemstore can be specified with the STORE= option in the DEFINE statement.
libname p "\\public\templates";

proc template;
  define statgraph graphs.distribution / store=p.templat ;
     ...
  end;
  define statgraph graphs.regression / store=p.templat ;
     ...
  end;
run;
When this template code is submitted, you see the following notes in the SAS log:
NOTE: STATGRAPH 'Graphs.Distribution' has been saved to:
PUBLIC.TEMPLAT
NOTE: STATGRAPH 'Graphs.Regression' has been saved to:
PUBLIC.TEMPLAT
After shared templates are compiled and stored, others can access them to produce graphs.
libname p "\\public\templates" access=readonly;

ods path reset;
ods path (prepend) p.templat(read) ;

proc sgrender data= ... template=graphs.distribution;
  dynamic var="height";
run;
Manipulating the ODS search path is the best way to make the templates publicly available.
Note that this code did not replace the path but rather added an item store at the beginning of the path. This is done to allow access to all SAS-supplied production templates, which are stored in SASHELP.TMPLMST.
ods path show;
Current ODS PATH list is:
1. P.TEMPLAT(READ)
2. SASUSER.TEMPLAT(UPDATE)
3. SASHELP.TMPLMST(READ)