Date: Tue, 22 Apr 2003 11:29:18 -0400
Reply-To: Ian Whitlock <WHITLOI1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ian Whitlock <WHITLOI1@WESTAT.COM>
Subject: Re: Using CARDS in a macro environment
Content-Type: text/plain
Richard,
Rearrange the code, since CARDS cannot be used in macro because physical
lines are not respected by macro. here are three possible solutions.
data names;
input dept $ item $;
cards;
BB Boat
SK Ski
;
%macro test(data=names);
/* whatever you have the macro for */
%mend;
%test()
Or you could put the data in a file and use
%macro test(file="c:\test.dat");
data names;
infile &file ;
input dept $ item $;
run ;
/* whatever you have the macro for */
%mend;
Or you could use your editor and have
%macro test;
data names;
length dept item $ 8 ;
dept = "BB" ; itemp = "Boat" ; output ;
dept = "SK" ; item = "Ski" ; output ;
run ;
/* whatever you have the macro for */
%mend;
%test;
IanWhitlock@westat.com
-----Original Message-----
From: (Richard Simhon) [mailto:richard.simhon@ALLIANZCORNHILL.CO.UK]
Sent: Tuesday, April 22, 2003 6:11 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Using CARDS in a macro environment
All,
Could anyone tell me why this should fall over? Outside of the macro the
dataset names works fine. The use of CARDS inside the macro causes it to
fall over. Can this be resolved?? Working with SAS8.2 on WINDOWS NT Thanks
in advance
%macro test;
data names;
input dept $ item $;
cards;
BB Boat
SK Ski
;
%mend;
%test;
Message from the log:
1
2 %macro test;
3
4 data names;
5 input dept $ item $;
6 cards;
7 BB Boat
8 SK Ski
9 ;
10
11 %mend;
12
13 %test;
ERROR: The macro TEST 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.NAMES has 0 observations and 2 variables.
NOTE: DATA statement used:
real time 0.08 seconds
cpu time 0.08 seconds
ERROR: The macro TEST will stop executing.
Richard Simhon
Business Analyst
Allianz Cornhill
Personal Lines
Email: Richard.Simhon@allianzcornhill.co.uk
************************************************************
Copyright in this message and any attachments remains
with us. It is confidential and may be legally privileged.
If this message is not intended for you it must not be read, copied or used
by you or disclosed to anyone else. Please advise the sender immediately if
you have received this message in error.
Although this message and any attachments are believed
to be free of any virus or other defect that might affect
any computer system into which it is received and opened
it is the responsibility of the recipient to ensure that
it is virus free and no responsibility is accepted by
Allianz Cornhill Insurance plc for any loss or damage in
any way arising from its use.
Cornhill Life, Cornhill Direct and Allianz Global Risks
are trading names of Allianz Cornhill Insurance plc.
Petplan and DBI are part of the Allianz Cornhill group of companies.
Allianz Cornhill Insurance plc, Registered in England
number 84638. Registered Office: 57 Ladymead, Guildford,
Surrey GU1 1DB.
Allianz Cornhill Insurance plc is authorised and regulated
by the Financial Services Authority.
Member of the General Insurance Standards Council for
general insurance business.
************************************************************