Because the GENERATE SOURCE control statement
runs against the WORKS.FAXES data set, and the WORKS library is
deleted at the end of the current SAS session (or, in
batch/background, SAS procedure), you must submit this code after
the staging code in the same SAS session or procedure.
Thus, if you submit the staging code from the PROGRAM EDITOR
window, you would follow by submitting this code from the PROGRAM
EDITOR window during the same SAS session. Or you would place
both sets of code in the same SAS procedure in a batch job.
Here is the code for generating the table and
variable definitions for the fax data:
%cpcat; cards4;
GENERATE SOURCE NAME=ufaxes
TYPE=event
ENTRYNAME='sasuser.cpddutl.faxes.source';
DATASET='work.faxes';
REPLACE ;
;;;; /* ;;;; must begin in column 1 to terminate the input stream */
%cpcat(cat=sasuser.cpddutl.generate.source);
%cpddutl (entrynam=sasuser.cpddutl.generate.source);
Notes:
- For purposes of constructing the table
and variable definitions, the model data set can be
created by running the staging code with a null input
file. This results in a model data set that is empty of
data but has the needed data descriptors.
- The first invocation of the IT Service
Vision %CPCAT utility macro copies in-stream text to a
buffer. The SAS language CARDS4 statement indicates the
beginning of the in-stream text. The four semicolons,
starting in column 1, indicate the end of the in-stream
text. In this case, the in-stream text consists of a
GENERATE SOURCE control statement.
- The second invocation of the %CPCAT macro
finds the stream of cards in the buffer and stores them
in the indicated SAS catalog .SOURCE entry. In this case,
it stores them in the SASUSER library, in the CPDDUTL
catalog, in the GENERATE entry, which is of type SOURCE.
(The SASUSER library is pre-defined and is not deleted
when the SAS session ends.) For more information about
the %CPCAT utility macro, see the Macro
Reference documentation for IT Service Vision.
- The invocation of the IT Service Vision
%CPDDUTL macro finds the CPDDUTL control statements in
the specified SAS catalog entry and runs them. In this
case, it reads the SASUSER.CPDDUTL.GENERATE.SOURCE entry
and runs the GENERATE SOURCE statement that it finds
there. The GENERATE SOURCE statement specifies that the
WORK.FAXES data set is to be read and that the
corresponding table and variable definitions are to be
generated and written to the SAS catalog entry that is
named SASUSER.CPDDUTL.FAXES.SOURCE. The GENERATE SOURCE
statement also specifies that the definitions are to
replace whatever is in that entry ( if anything is in
that entry), that the definitions are to name the table
UFAXES, that the table is to be specified as type EVENT,
and that the staged data set's name of the variable that
contains date and time is TIMESTMP.
- At any point, if you want to see the
contents of a SAS catalog entry, you can define the
libref for that library (if it is not already defined)
and then use the COPY command to display the entry in
your PROGRAM EDITOR window. The libref SASUSER is already
defined, so in this case, you would need only the command
copy sasuser.cpddutl.faxes.source
(You can enter commands by using the
Globals pull-down menu.)
- For more information about the %CPDDUTL
macro, see the Macro Reference documentation for
IT Service Vision
To see the CREATE TABLE and CREATE VARIABLE
control statements that are generated, see Fax Appendix 4: Sample Table and
Variable Definitions.
The generated control statements include
attribute information such as the variable interpretation type,
the format to use for displaying the data, the default statistics
to collect, and the BY and CLASS variables. For more on how
GENERATE SOURCE determines what information to use, see Generic Collector
Appendix 1: Algorithm Used by GENERATE SOURCE.