When generator definitions expand beyond what is comfortable
to write in a single generator, you can split
your
generator into sub-generators. A sub-generator is just a normal generator
definition, run with the
subreport; 'generator
name'; run; command from within another generator. The sub-generator
is executed as if the full contents of the definition of the sub-generator were
directly included in the definition of the parent generator. They thus inherit
the same set of open files, and same generator stack as the parent. See the
definition of the
subreport command in
the Section
5.3.4 for more details and
ways of using sub-generators.
Generators whose names
begin with
'_' are hidden from the list shown to the user when choosing
Generate...
elsewhere than the Generator Editor (e.g. from a Diagram Editor). Names like
this should thus be used for generators that are intended only for use as
sub-generators, e.g. if they assume that the generation output is already going
to a file, or that something other than a graph is already in the generator
stack. If necessary, a user can still see and even run these generators
elsewhere by holding down shift while choosing
Generate....
Writing generators allows you to take advantage of some
powerful object-oriented principles. If your generator follows subgraph links to
a different graph type, it is often best to create a sub-generator in that graph
type, rather than defining it in the original graph type. This is similar to
choosing which class to define a method in when programming. Similarly, if a
generator you write is applicable to more than one graph type, there is no need
to duplicate it to both graph types: simply define it in a common supertype, or
in the supertype of all graph types, Graph itself. This is similar to the
principle of
inheritance.