Hi there, I've only been using sas for about 18 months, and mainly easy stuff. I'm just now venturing into the macro world. That said, I am trying to figure out how to do something. I've tried several things but I can't seem to figure out the best approach. I have two datasets, one I'll call "People" and one I'll call "Dates". The people dataset is a listing of, you guessed it, a lot of people and their information. The dates dataset contains a listing of contract periods (effective and end date) that their employer has agreed to. My goal is to identify the correct contract period when the person turned (or will turn) a specific age (19). My problem is that some people were 19 before the earliest contract, so it wouldn't exist (I need to default to the earliest in that situation) and some people won't be 19 for a few years (so I need to default to the highest in that situation). In Visual Basic, this would be easy. I would create a function to take the person's 19th birthday (already got this down), then loop through each contract until I find the one that would encompass the birthday and return the contract's end date to the calling subroutine, then I can do the rest of my calculations based on that. I've tried writing a macro in SAS but I always seem to run into errors. Been stuck on this for a few days. I hope somebody here might point me in the right direction? Thanks!
... View more