LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 7 Aug 2008 07:23:37 -0400
Reply-To:     Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gerhard Hellriegel <gerhard.hellriegel@T-ONLINE.DE>
Subject:      Re: Referencing an array defined in a data step in a macro??

On Thu, 7 Aug 2008 12:26:15 +0200, Erwan LE DU <dotker@GMAIL.COM> wrote:

>Hi all, > >Is it possible to reference an array defined in a data step within a macro? > >I have the following array : > > >ARRAY ATITLE{*} $ t1-t3 ('# Patients per Month','Diagnosis','Diagnosis made >in'); > >defined in a data step which I'd like to call in a macro to assign the >titles for some procedure. Is it possible to do this or do I have to define >the array directly in the macro? > >Thanks, > >Regards, > >Ker

Hi Ker, don't understand, what you want to do (my english might be too bad...). What does that mean "I have an array..."? A array is a temporary construct, which is available in a DATA step. It can be used to bundle a list of variables to allow a indexed access to that variables, e.g. in a loop. In the background of that array elements there are the variables. Each manipulation of the array contents are made on the original variables, the array elements are only alias-names for the originals. It is not necessary to link arrays with datastep-variables, it can also be temporary. In both cases the array is gone when the DATA step ends.

In macros there are no arrays. You can define something which could be used like an array:

%let a1=1; %let a2=2; %let a3=3;

%do i=1 %to 3; %put &i = &&a&i; %end;

Gerhard


Back to: Top of message | Previous page | Main SAS-L page