Hi, Well, a few things. Firstly its not clear what your question is, am not writing a whole program. Secondly, write the code to something once before you try to look at macro. Macro is at the end of the day just a code generator, so you need to know what your code should look like. Also, look at it from another point, is a macro really necessary, can you code or arrange the data in a different way to do something in straight code. There are some circumstances, i.e. if you develop a macro for a team, where creating a macro is good, and then you would follow SDLC anyways which would detail your code more or less. For the points you make, its pretty much all about merging. There are many documents on SAS help about this, various types of merging etc. Or you might consider SQL merges: A Visual Explanation of SQL Joins As for calculating days difference you have numerous procedures INTCK for example, or if they are both dates just take one from the other.
... View more