Previous Page | Next Page

Macro Statements

%COPY Statement



Copies specified items from a SAS macro library.
Type: Macro statement
Restriction: Allowed in macro definitions or open code
See also:

%MACRO Statement

SASMSTORE= System Option


Syntax
Example

Syntax

%COPY macro-name /<option1 <...option-n>> SOURCE

macro-name

name of the macro that the %COPY statement will use.

SOURCE
SRC

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= libref
LIB=

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

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; */;

Previous Page | Next Page | Top of Page