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 2007, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 29 Aug 2007 12:29:38 -0700
Reply-To:   "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Schwarz, Barry A" <barry.a.schwarz@BOEING.COM>
Subject:   Re: Operation with arrays
In-Reply-To:   <OF6DC2F4F7.768578A7-ON03257346.005BB340-03257346.005C83F6@serasa.com.br>
Content-Type:   text/plain; charset="iso-8859-1"

Arrays are not data structures that can exist within a data set. They are temporary names used to group variables for ease of reference. They exist only during the execution of the data step in which they are defined.

If you have a data set A with variables a1 through a98 and a data set B with variables b1 through b98, then you can do

DATA new (KEEP = a1-a98); SET A; SET B; ARRAY varia {*} a1-a98; ARRAY cred {*} b1-b98; DO i = 1 TO DIM(varia); varia(i) = varia(i) - cred(i); END; RUN;

Barry Schwarz OS/390 System Programmer M/S 80-JE Phone: 253-773-4221 Fax: 253-773-1257

-----Original Message----- From: Ricardo G Silva [mailto:ricardosilva@SERASA.COM.BR] Sent: Wednesday, August 29, 2007 9:51 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Operation with arrays

Dear Users,

I construct the following arrays:

%LET LO=1; %LET HI=98;

DATA A; SET B; ARRAY VARIA {&LO:&HI}; RUN;

DATA c; SET D; ARRAY CRED {&LO,&HI}; RUN;

Now I want to subtract from each line varia1 ... varia98 another array with size (1,98), that is, for each line of VARIA I need to subtract the line Cred

How can I do it?

Thanks

Rick

Ricardo Gonçalves Silva, M. Sc. Tecnologia de Crédito SERASA S.A. É (11) - 6847-8889 ? ricardosilva@serasa.com.br


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