From: Michael Raithel on
Dear SAS-L-ers,

"New SAS" sent me the email following the Sig line.

New SAS, please send emails like this to the SAS-L list; do not send them d=
irectly to me. Doing so will get you the widest possible group of brainiac=
s that can read and address your questions. And, it will allow you to avoi=
d my pricy one-on-one consulting fee:)

Unfortunately, I cannot help you get dates with this girl. Maybe somebody =
else on the list can!

New SAS, best of luck in all your SAS endeavors!

I hope that this suggestion proves helpful now, and in the future!
Of course, all of these opinions and insights are my own, and do not reflec=
t those of my organization or my associates. All SAS code and/or methodolog=
ies specified in this posting are for illustrative purposes only and no war=
ranty is stated or implied as to their accuracy or applicability. People de=
ciding to use information in this posting do so at their own risk.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Michael A. Raithel
"The man who wrote the book on performance"
E-mail: MichaelRaithel(a)westat.com
Author: Tuning SAS Applications in the MVS Environment
Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second=
Edition
http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=3D1&pc=3D58172

Author: The Complete Guide to SAS Indexes
http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=3D1&pc=3D60409

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I've been on so many blind dates, I should get a free dog. - Wendy Liebman
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



I have a following datatset "Girl" with three variables (SID1A, AEVSTT1D,AE=
VEND1D, trt)

SID1A AEVSTT1D AEVEND1D trt
0150_00002 11APR2007 11APR2007 A
0150_00002 18APR2007 20APR2007 A
0150_00002 02MAY2007 04MAY2007 A
0150_00002 05MAY2007 07MAY2007 A
0150_00002 08MAY2007 08MAY2007 A
0150_00002 09MAY2007 10MAY2007 A
0150_00002 11MAY2007 16MAY2007 A
0150_00002 24MAY2007 24MAY2007 A
0150_00002 26MAY2007 26MAY2007 A
0150_00002 27MAY2007 27MAY2007 A
0150_00002 28MAY2007 28MAY2007 A
0150_00002 29MAY2007 29MAY2007 A
0150_00002 30MAY2007 31MAY2007 A
0150_00002 30AUG2008 30MAY2008 A
0012_00002 17NOV2006 23NOV2006 B
0012_00002 03DEC2006 19DEC2006 B
0012_00002 21DEC2006 26DEC2006 B
0012_00002 27DEC2006 19JAN2007 B
0012_00002 27DEC2007 29JAN2008 B


I have another dataset "Boy" as below with three variables (SID1A,CYCLE,SM=
DDOS1D)


SID1A CYCLE SMDDOS1D
0150_00002 1 06APR2007
0150_00002 2 27APR2007
0150_00002 3 18MAY2007
0012_00002 1 08NOV2006
0012_00002 2 29NOV2006
0012_00002 3 20DEC2006

I need to merge them (Boy and Girl) such a way that if the value for the va=
riable
AEVSTT1D, AEVEND1D from the dataset "Girl" falls in between the 2nd value=
of SMDDOS1D
and first value of SMDDOS1D from "Boy" (such as anything before 06APR2007 O=
R such
as (26apr2007 - 06aprl2007).or such as (17MAY2007- 27APR2007)). Also if las=
t
observation of value for the variable if trt =3D "A" and AEVEND1D is more =
than
28 days after of the value of SMDDOS1D (ONLY the last observation - By CYC=
LE,of
the dataset "Boy" )and if trt =3D "B"and AEVEND1D is more than
21 days after of the value of SMDDOS1D (ONLY the last observation - By CYC=
LE, of the dataset
"Boy" ) then they should not be included in teh final dataset.
The result dataset should be as below:


SID1A AEVSTT1D AEVEND1D Cycle
0150_00002 11APR2007 11APR2007 1
0150_00002 18APR2007 20APR2007 1
0150_00002 02MAY2007 04MAY2007 2
0150_00002 05MAY2007 07MAY2007 2
0150_00002 08MAY2007 08MAY2007 2
0150_00002 09MAY2007 10MAY2007 2
0150_00002 11MAY2007 16MAY2007 2
0150_00002 24MAY2007 24MAY2007 3
0150_00002 26MAY2007 26MAY2007 3
0150_00002 27MAY2007 27MAY2007 3
0150_00002 28MAY2007 28MAY2007 3
0150_00002 29MAY2007 29MAY2007 3
0150_00002 30MAY2007 31MAY2007 3
0012_00002 17NOV2006 23NOV2006 1
0012_00002 03DEC2006 19DEC2006 3
0012_00002 21DEC2006 26DEC2006 3
0012_00002 27DEC2006 19JAN2007 3

Tahnks you so much. It's complex and confusing. But if you look the final r=
esult dataset that
make more sense than the description.