Date: Mon, 31 Mar 2003 19:01:07 +0100
Reply-To: Dwight Eggers <deggers@OPERAMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Dwight Eggers <deggers@OPERAMAIL.COM>
Subject: macro resolution issue?
Content-Type: text/plain; charset="iso-8859-1"
I need some help with a tricky (for me) macro
resolution issue. I am writing a macro with a variable
number of positional parameters -- LIST1, LIST2, ...
LISTn, ... -- where the parameters are passed by-name
rather than by-value. I want to access one element of the
value associated with a parameter by a %SCAN function. For
example,
%let ALIST=%str(AAA BBB CCC);
%let BLIST=%str(111 222 333);
%let CLIST=%str(A1 B2 C3);
%mymacro (ALIST, BLIST, CLIST);
where MYMACRO is defined as
%macro mymacro (LIST1, LIST2, LIST3, LIST4, ...) / parmbuff ;
I want to access elements of the lists associated with the
parameters with something like a
%do j=1 %to 3;
%do i=1 %to &nparms;
%scan(???LIST&i, &j)
%end;
%end;
where ??? represents the sequence of &'s or the quoting
function that I need. Local variable NPARMS is determined
from the SYSPBUFF variable. In the first pass of the macro
resolution, I want the &i to be resolved. In the second
pass, I want the &LISTn to be resolved. Then finally in
the third pass, the %scan function would be applied to the
appropriate list. For the variable settings I gave above,
this pair of nested %do loops would resolve to
AAA
111
A1
BBB
222
B2
CCC
333
C3
I am uncertain what combination of &'s and quoting
function(s) I should be using to get this %scan step to
resolve properly.
Thanks,
Dwight Eggers
--
____________________________________________
http://www.operamail.com
Get OperaMail Premium today - USD 29.99/year
Powered by Outblaze