I have 2 datasets like this
Dataset 1:
From To Period
01/1/2000 20/1/2000 1
21/1/2000 14/2/2000 2
15/2/2000 31/3/2000 3
Dataset 2:
Date
15/1/2000
13/2/2000
20/3/2000
And the desired result would be like this:
Date Period
15/1/2000 1
13/2/2000 2
20/3/2000 3
I think the solution for this is going through dataset 2 by each record, look up and compare the dataset 2 date value with the range From To in Dataset 1 until a match is found, then get the Period value. Are we able to do this with SAS datastep code not sql? And if we do, the performance wise, would it be better?
Thanks for your help in advance, really appreciate it.