Hi,
I'm just having a hard time visualizing how your data are structured or what you need to do. For example...if the data looked like this:
[pre]
data want;
infile datalines;
input code $ datewant : mmddyy10.;
return;
datalines;
code1 11/15/1950
code2 06/30/1949
;
run;
data search;
infile datalines;
input name $ date1 : mmddyy10. date2 : mmddyy10.;
return;
datalines;
lucy 12/05/1951 01/15/1953
ricky 11/15/1950 12/05/1951
fred 12/01/1948 11/15/1950
ethel 06/30/1949 08/12/1952
;
run;
ods listing ;
proc print data=want;
title 'want these';
format datewant mmddyy10.;
run;
proc print data=search;
title 'search here';
format date1 date2 mmddyy10.;
run;
[/pre]
Are you saying that you would check every date field on every obs in the 'Search' dataset to see if DATEWANT was found in either DATE1 or DATE2 ??? Is there a way to fabricate some test data that illustrates your problem a bit better???
Given the above data, I'd be very tempted to use a FORMAT for a lookup, assuming that the dates to lookup was a reasonable sized list.
[pre]
proc format;
value wantdate '15Nov1950'd = 'y'
'30Jun1949'd = 'y'
other='n';
run;
data search;
infile datalines;
input name $ date1 : mmddyy10. date2 : mmddyy10.;
ckdate1 = put(date1,wantdate.);
ckdate2 = put(date2,wantdate.);
return;
datalines;
lucy 12/05/1951 01/15/1953
ricky 11/15/1950 12/05/1951
fred 12/01/1948 11/15/1950
ethel 06/30/1949 08/12/1952
;
run;
[/pre]
And then the proc print of the above file would look like this (if you selected where ckdate1 = 'y' or ckdate2 = 'y'):
[pre]
Obs name date1 date2 ckdate1 ckdate2
2 ricky 11/15/1950 12/05/1951 y n
3 fred 12/01/1948 11/15/1950 n y
4 ethel 06/30/1949 08/12/1952 y n
[/pre]
There are lots of ways to make this automated using SAS to create a format from the "want" data set and using SAS macro variables/programs, but there's no point going farther down this road if your data is significantly different.
cynthia