Date: Fri, 6 Jul 2007 16:45:49 -0400
Reply-To: "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (CDC/CCHIS/NCPHI)" <rjf2@CDC.GOV>
Subject: Re: Array Question : Accessing original variable name that
indexed array variable points to
In-Reply-To: <89C159F45B13A24682D98BDEF58E451F1066E4DE@TLRUSMNEAGMBX28.ERF.THOMSON.COM>
Content-Type: text/plain; charset=us-ascii
> From: matt.pettis
> Subject: Array Question : Accessing original variable name
> that indexed array variable points to
>
> Hi,
>
> Is there any function that allows me to access the variable
> name of the variable that the current indexed array is
> pointing at?
you want to RTFM on call vname
> Here is an example:
>
> data _null_;
attrib Vname length = $ 32;
> array x {3} a b c;
retain Testing 1;
> set work;
> do i=1 to dim(x);
> /* Is there a way to programatically see that */
> /* the name of the variable that */
> /* x{i} points to is 'a', 'b', or 'c', depending on */
> /* what value i is in the loop? */
call vname(x(I),Vname);
if Testing then putlog Vname= X(I)=;
> end;
> run;
I don't guarantee that the putlog will write both values
Ron Fehd the macro maven CDC Atlanta GA USA RJF2 at cdc dot gov