Date: Thu, 18 Jan 2007 19:58:12 -0500
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Macro Variable w. Another Macro Variable in name
Are you trying to accomplish something like:
%macro testidea;
%let myarray=XX XY YY;
%do i=1 %to 3;
%let s0=%scan(&myarray,&i);
%let count&s0=0;
%put &&count&s0;
%end;
%mend;
%testidea
HTH,
Art
-------
On Thu, 18 Jan 2007 18:31:06 -0600, OR Stats <stats112@GMAIL.COM> wrote:
>Hello, A quick syntax question. I have a predefined nx1 char array [ XX
XY
>YY . . .]. I would like to create a macro variable which is a function
of a
>dataset with respect to an element of the array. More specifically, I
would
>like n of these macro variables; one for each element of my array. What I
>am having trouble w. is referencing these 'nested' macro variables.
>
>Say, I would like to call the variables countXX, countXY, countYY, etc.;
>where countXX is some function of XX (i.e., the first element of the
array)
>and an existing dataset that I have. How do I call it? The following did
>not work:
>
>%do i=1 %to 3;
>%let myarray=XX XY YY
>%let s0=%scan(&myarray,&i);
>%let count&s0=0
>%put(&count&s0);
>%end;
>
>To keep it simple, I did not bring the dataset into the above picture.
>What's wrong w. my syntax?
>
>Merci
|