From: MarySAS on
Thanks to anyone who can help me with this. I am working with two
large datasets. The first table, JAN, is huge, 140million records,
distinct by PersonID, EventDate and Hour.
PersonID
EventDate
Hour
EventAmt

The second table, MASTER, has 2 fields RateCode and Cycle that I need
to lookup and put onto the first file. A person can have different
cycle and rate codes for different days or range of days. The Second
table has 1 million records, distinct by PersonID, FromDate and
ToDate:
PersonID
FromDate
ToDate
RateCode
Cycle

I’m sure you could do a SQL statement and get from table B values
where the ID’s match and the FromDate <= EventDate and ToDate >=
EventDate, but I think that a HASH would be much quicker. But, I’m
very new to HASH and am trying to figure out how to set this up.
Here’s what I have so far:

/
*****************************************************************************************/
Data JanNew;
Set Jan;

If _n_ = 0 then set Master;
If _n_ = 1 then do;
Declare hash MAS (Dataset : ‘master’, multidata: ‘Y’, Ordered: ‘A’)

Rc=mas.definekey (‘PersonId’);

Rc=mas.definedata (‘fromdt’, ‘todate’, ‘ratecode’, ‘cycle’);

RC=mas.definedone();

Do until (eof);
Set Jan end=eof;
RC=mas.find ();
If RC = 0 then do;
If FromDate <= EventDate <= ToDate then …………??????????
/
*****************************************************************************************/




I’m lost as to how to check the dates to make sure I am looking at the
right lookup records, then get the variables back from the hash object
and output the Event record.
From: MarySAS on


Thanks Patrick!!! This was very helpful. I appreciate the
response. Thanks again. --Mary
From: MarySAS on


Thanks Michelle!! Between your response and another one, I learned
what I needed to do to get my hash working. I appreciate your
response to my question. Thanks again,
Mary