%COPY Statement
Copies specified items from a SAS macro library.
Syntax
%COPY macro-name /<option1 <...option-n>> SOURCE
Required Arguments
- macro-name
-
name of the macro that
the %COPY statement will use.
- SOURCESRC
-
specifies that the
source code of the macro will be copied to the output destination.
If the OUTFILE= option is not specified, the source is written to
the SAS log.
- option1 <...option-n>
-
must be one or more
of the following options:
- LIBRARY= librefLIB=
-
specifies the libref
of a SAS library that contains a catalog of stored compiled SAS macros.
If no library is specified, the libref specified by the SASMSTORE=
option is used.
Restriction: |
This libref cannot be WORK. |
- OUTFILE=fileref | 'external file'OUT=
-
specifies the output
destination of the %COPY statement. The value can be a fileref or
an external file.
Example: Using %COPY Statement
In the following example,
the %COPY statement writes the stored source code to the SAS log:
/* commentary */ %macro foobar(arg) /store source
des="This macro does not do much";
%put arg = &arg;
* this is commentary!!!;
%* this is macro commentary;
%mend /* commentary; */; /* Further commentary */
NOTE: The macro FOOBAR completed compilation without errors.
%copy foobar/source;
The following results
are written to the SAS log:
%macro foobar(arg) /store source
des="This macro does not do much";
%put arg = &arg;
* this is commentary!!!;
%* this is macro commentary;
%mend /* commentary; */;