Date: Tue, 26 Apr 2005 17:39:17 -0400
Reply-To: Nishant Dholakia <nishant.dholakia@gmail.com>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Nishant Dholakia <nishant.dholakia@GMAIL.COM>
Subject: Re: first. last.
In-Reply-To: <426EB25E.4030902@rtp.ppdi.com>
Content-Type: text/plain; charset=ISO-8859-1
Thanks so much,
this made things much clear however for part 2 you have marked as
first.x and first.y etc however since its the same variable and i want
to access only first.y(var name) however the first.y goes from s to b.
so can i write something like this.
if first.y =s then do;
if first.y=b then do; (will this capture the first values of y for the same x)
Thanks
On 4/26/05, Eric Yount <eric.yount@rtp.ppdi.com> wrote:
> Hi Nishant,
>
> I numbered your obs to explain better;
>
> Your data:
> obs x
> 1 1
> 2 1
> 3 1
> 4 1
> 5 1
> 6 2
> 7 2
> 8 3
> 9 4
> 10 4
>
> If you subset on the condition first.x = last.x, you will end up with:
>
> obs x
> 2 1
> 3 1
> 4 1
> 8 3
>
> This is because obs 2-4 will have both first.x and last.x = 0, while obs 8 has
> both = 1. Here's your data with first.x and last.x filled in:
>
> obs x first.x last.x
> 1 1 1 0
> 2 1 0 0
> 3 1 0 0
> 4 1 0 0
> 5 1 0 1
> 6 2 1 0
> 7 2 0 1
> 8 3 1 1
> 9 4 1 0
> 10 4 0 1
>
> As for the second part of your question, take a look at this, and I think you'll
> be able to follow.
>
> x y first.x last.x first.y last.y
> 1 s 1 0 1 0
> 1 s 0 0 0 0
> 1 s 0 0 0 1
> 1 b 0 0 1 0
> 1 b 0 1 0 1
>
> Sorry this is so long, hope it helps,
> Eric
>
> Nishant Dholakia wrote:
> > Hi,
> > I have a simple fundamental question regarding first.x and last.x.
> >
> > lets say
> > x
> > 1
> > 1
> > 1
> > 1
> > 1
> > 2
> > 2
> > 3
> > 4
> > 4
> > if I put in the condition if first.x=last.x will I get the result to be 3
> > only. I think it will.
> >
> > also if the sort on x and y goes like this
> > (they are sorted)
> >
> > x y
> > 1 s
> > 1 s
> > 1 b
> > 1 b
> > 1 b
> >
> > then will first.y mean s and how do I get the value of b which is also
> > technically first.y
> >
> > Thanks
> >
>
> ______________________________________________________________________
> This email transmission and any documents, files or previous email
> messages attached to it may contain information that is confidential or
> legally privileged. If you are not the intended recipient or a person
> responsible for delivering this transmission to the intended recipient,
> you are hereby notified that you must not read this transmission and
> that any disclosure, copying, printing, distribution or use of this
> transmission is strictly prohibited. If you have received this transmission
> in error, please immediately notify the sender by telephone or return email
> and delete the original transmission and its attachments without reading
> or saving in any manner.
>
--
Nishant H. Dholakia
607 262 0860
"its your attitude not your aptitude that determines your altitude"
|