Date: Sun, 26 Aug 2007 20:41:39 -0400
Reply-To: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sigurd Hermansen <HERMANS1@WESTAT.COM>
Subject: Re: Matching Variables
In-Reply-To: <200708262255.l7QAklQH001283@malibu.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"
Randy:
I am sure that you have compelling reasons for creating a data structure
that takes data from one odd pattern to another. Quite frankly your
database design efforts appear to be headed in the wrong direction. If
VarD and VarE have a relation to ONumber, whatever that might be, why
should you add redundant time values to the same Basic dataset?
I'd advise taking a step back and writing a simple description of what
you are trying to accomplish. I don't see how you are distinguishing one
row of data from another in your example. If you are trying to create an
informative display of your Basic dataset, it might be easier to do that
and not complicate things even more.
S
-----Original Message-----
From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu]
On Behalf Of Randy
Sent: Sunday, August 26, 2007 6:56 PM
To: SAS-L@LISTSERV.UGA.EDU
Cc: SUBSCRIBE SAS-L Anonymous
Subject: Matching Variables
All:
Here is my Basic data Set.
VarA VarB VarC Time ONumber VarD VarE
1 A B 10:55:01 100
1 A S 10:55:01 101
1 A S 10:55:01 102
1 A B 10:55:01 103
B 10:55:01 102 103
2 A S 10:55:02 101
B 10:55:02 101 103
I want to create two new variables, VarF and VarG.
When VarB = B, VarD should be matched with the ONumber and VarF should
be populated with the Time of the ONumber under VarD. Similarly, when
VarB= B, VarE should be matched with the ONumber and VarG should be
populated with the Time of the ONumber under VarE. My manipulated data
set should therefore look like this:
VarA VarB VarC Time ONumber VarD VarE VarF VarG
1 A B 10:55:01 100
1 A S 10:55:01 101
1 A S 10:55:01 102
1 A B 10:55:01 103
B 10:55:01 102 103 10:55:01 10:55:01
2 A S 10:55:02 101
B 10:55:02 101 103 10:55:02 10:55:01
Note: ONumber 101 has been modified at 10:55:02 (indicated by VarA=2) so
the time for 0Number 101 = 10:55:02 and not 10:55:01.
Please Help.
Randy