Date: Fri, 17 May 2002 14:42:18 -0400
Reply-To: Marianne Whitlock <WHITLOM1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Marianne Whitlock <WHITLOM1@WESTAT.COM>
Subject: Re: How to avoid this hard code?
Content-Type: text/plain; charset="iso-8859-1"
Try something like:
data A ;
input ParmValue $char8. ;
cards;
B0000001
B0000005
B0000008
;
%macro call_macro (name=) ;
data _null_ ;
x = "&name" ;
put x= ;
run;
%mend call_macro;
data _null_ ;
set A ;
call execute ( '%nrstr(%call_macro('
|| 'name= '|| ParmValue || '))'
) ;
run;
-----Original Message-----
From: amy [mailto:amywang11790@YAHOO.COM]
Sent: Friday, May 17, 2002 2:29 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: How to avoid this hard code?
How to avoid this hard code?
Right now, I hard code a list as the parameter of a macro, as
following (a hundrad lines):
%call_macro (name='B0000001');
%call_macro (name='B0000005');
%call_macro (name='B0000008');
%call_macro (name='B0000012');
%call_macro (name='B0000021');
......
I intend to save the name list in a dataset, then call_macro by
reading from dataset A,
i.e. dataset will include:
B0000001
B0000005
B0000008
B0000012
.....
Or is there any other way to avoid hard code?
TIA,
Amy