Date: Tue, 31 Jul 2001 12:23:44 -0400
Reply-To: "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Droogendyk, Harry" <Harry.Droogendyk@CIBC.COM>
Subject: Re: Strange Macro Problem
Content-Type: text/plain; charset="iso-8859-1"
CARDS cannot be used inside a macro.
From SAS v8.2 online help:
The %MACRO statement begins the definition of a macro, assigns the macro a
name, and optionally can include a list of macro parameters, a list of
options, or both.
A macro definition must precede the invocation of that macro in your code.
The %MACRO statement can appear anywhere in a SAS program, except within
data lines. A macro definition cannot contain a CARDS statement, a DATALINES
statement, a PARMCARDS statement, or data lines. Use an INFILE statement
instead.
-----Original Message-----
From: Ivis, Frank [mailto:frank.ivis@ICES.ON.CA]
Sent: Tuesday, July 31, 2001 12:14 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Strange Macro Problem
Can anyone explain what is going on with the code below? I
just have a
simple data step with an input statement, but it does not
work within a
macro! I have tested this with 8.0 Windows and 8.2 UNIX.
Thank you in advance for any help,
Frank
90 o
MPRINT():
90 ! ptions mprint;
91 %macro junk;
92 data test;
93 input x y;
94 cards;
95 1 2
96 3 4
97 ;
98 run;
99
100 %mend junk;
101 %junk
MPRINT(JUNK): data test;
MPRINT(JUNK): input x y;
MPRINT(JUNK): cards;
ERROR: The macro JUNK generated CARDS (data lines) for the
DATA step, which
could cause
incorrect results. The DATA step and the macro will
stop executing.
NOTE: The data set WORK.TEST has 0 observations and 2
variables.
NOTE: DATA statement used:
real time 0.04 seconds
ERROR: The macro JUNK will stop executing.
___________________________________________________________________________
This email may contain confidential and/or privileged
information for the
sole use of the intended recipient. Any review or
distribution by others is
strictly prohibited. If you have received this email in
error, please
contact the sender and delete all copies. Opinions,
conclusions or other
information expressed or contained in this email are not
given or endorsed
by the sender unless otherwise affirmed independently by the
sender.