Date: Thu, 8 Mar 2012 20:11:10 +0000
Reply-To: "Fehd, Ronald J. (CDC/OCOO/ITSO)" <rjf2@CDC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Fehd, Ronald J. (CDC/OCOO/ITSO)" <rjf2@CDC.GOV>
Subject: Re: Question about Arrays..
In-Reply-To: <6E21F7A6AABC3145B614930DBAB47EB908CE7430@WCLURIB00001009.corp.internal.citizensbank.com>
Content-Type: text/plain; charset="us-ascii"
> -----Original Message-----
> From: Sridhar, Nagakumar [mailto:Nagakumar.Sridhar@rbscitizens.com]
> Sent: Thursday, March 08, 2012 3:00 PM
> To: Fehd, Ronald J. (CDC/OCOO/ITSO)
> Subject: RE: Question about Arrays..
>
> Okay, but what if in your example:
> do I = 1 to dim(m);
> temp=lag(m(I));
> if row_no > 1 and temp ne ' ' and m(I) = ' ' then m(I)=temp;
> end;
>
> temp eq ' ' and m(I)=' '?
>
> TIA
>
> Kumar
The value of temp is from the previous row==observation.
so if the the previous row has m(I) eq empty
then no value is brought forward
You'll have to look at what your result is supposed to be
I can't answer that.
Ron Fehd blank == missing == null maven
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> Fehd, Ronald J. (CDC/OCOO/ITSO)
> Sent: Thursday, March 08, 2012 2:53 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: Question about Arrays..
>
> > From: Sridhar, Nagakumar
> > Sent: Thursday, March 08, 2012 2:35 PM
> > To: SAS-L@listserv.uga.edu
> > Subject: Question about Arrays..
> >
> > Hi All:
> >
> > The code below works but I am trying to find out what the logic is.
> > This code was handed over to me and the guy just left without telling
> me
> > what he was doing. I would appreciate it if you could tell me what
> this is
> > actually doing. I am also confused about whether the value of m is
> ever
> > going to be anything but missing (as all the elements of the array m
> are
> > character).
>
> The do over construction is deprecated.
> -- sooo 20-th century --
>
> a 21-st century implementation is:
>
> do I = 1 to dim(m);
> temp=lag(m(I));
> if row_no > 1 and temp ne ' ' and m(I) = ' ' then m(I)=temp;
> end;
>
>
> Ron Fehd array maven
>
>
> > data clean1;
> >
> > set tr1;
> >
> >
> >
> > /* array array-name array-elements */
> >
> > array m _character_;
> >
> > /* do over arrayname; - process array elements */
> >
> > do over m;
> >
> > temp=lag(m);
> >
> > if row_no > 1 and temp ne ' ' and m = ' ' then m=temp;
> >
> > end;
> >
> > array n _numeric_;
> >
> > do over n;
> >
> > temp2=lag(n);
> >
> > if row_no > 1 and temp2 ne . and n = . then n=temp2;
> >
> > end;
> >
> > *drop temp temp2;
> >
> > run;
> >
> >
> >
> >
> >
> >
> >
> > TIA
> >
> >
> >
> > Kumar Sridhar
> >
> >
> >
> >
> >
> > RBS Citizens, N.A. is an affiliate of Citizens Financial Group, Inc.
> Use of email
> > is inherently insecure. Confidential information, including account
> > information, and personally identifiable information, should not be
> > transmitted via email, or email attachment. In no event shall
> Citizens
> > Financial Group, Inc. or any of its affiliates accept any
> responsibility for the
> > loss, use or misuse of any information including confidential
> information,
> > which is sent to Citizens Financial Group, Inc. or its affiliates via
> email, or
> > email attachment. Citizens Financial Group, Inc. does not guarantee
> the
> > accuracy of any email or email attachment, that an email will be
> received by
> > Citizens Financial Group, Inc. or that Citizens Financial Group, Inc.
> will
> > respond to any email.
> >
> > This email message is confidential and/or privileged. It is to be used
> by the
> > intended recipient only. Use of the information contained in this
> email by
> > anyone other than the intended recipient is strictly prohibited. If
> you have
> > received this message in error, please notify the sender immediately
> and
> > promptly destroy any record of this email.
>
> RBS Citizens, N.A. is an affiliate of Citizens Financial Group, Inc. Use of email
> is inherently insecure. Confidential information, including account
> information, and personally identifiable information, should not be
> transmitted via email, or email attachment. In no event shall Citizens
> Financial Group, Inc. or any of its affiliates accept any responsibility for the
> loss, use or misuse of any information including confidential information,
> which is sent to Citizens Financial Group, Inc. or its affiliates via email, or
> email attachment. Citizens Financial Group, Inc. does not guarantee the
> accuracy of any email or email attachment, that an email will be received by
> Citizens Financial Group, Inc. or that Citizens Financial Group, Inc. will
> respond to any email.
>
> This email message is confidential and/or privileged. It is to be used by the
> intended recipient only. Use of the information contained in this email by
> anyone other than the intended recipient is strictly prohibited. If you have
> received this message in error, please notify the sender immediately and
> promptly destroy any record of this email.
|