Date: Tue, 14 Aug 2001 14:23:16 -0400
Reply-To: "Diskin, Dennis" <Dennis.Diskin@PHARMA.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Diskin, Dennis" <Dennis.Diskin@PHARMA.COM>
Subject: Re: Labelling array elements
Content-Type: text/plain
Nathan,
An indirect approach is possible via the VNAME call routine and call
execute:
Following (tested) example is based on V6.12 naming restriction of 8
characters.
data yourdata;
array r(4,3) a b c d e f g h i j k l ;
do _i = 1 to 4;
do _j = 1 to 3;
r(_i,_j) = _i*10+_j;
end;
end;
data _null_;
set yourdata;
array r(4,3) a b c d e f g h i j k l ;
length t $ 8;
call execute ('proc datasets lib=work; modify yourdata; label');
/* repeat the following pair for as many labes as you want to set */
call vname (r(2,2),t); /* puts variable name of r(2,2) into t */
call execute(t || "='R(2,2)' ");
call execute(';run;');
proc contents data=yourdata;
run;run;
This is one technique and could be macroized if it will be used often enough
to debug.
hth,
Dennis Diskin
> -----Original Message-----
> From: Appel, Nathan (NCI/IMS) [SMTP:AppelN@IMS.NCI.NIH.GOV]
> Sent: Tuesday, August 14, 2001 1:43 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Labelling array elements
>
> Hello,
>
> I have created some multidemensional arrays that have underlying
> variables. I would like to give those variables labels by indexing through
> the array. Is there anyway to give a variable a label indirectly using
> it's
> array reference ? Thanks
>
> N
|