I am trying to do the same thing as the OP (I believe), I want a set of lights (currently controlled by an appliance module) to come on when I enter the office, stay on for as long as I am in the office, and then shut off when I leave the office.
When using the MS16a, I created a set of macros (exactly like Mel99 did above) and it was working great. I have since switched my sensors around a little bit and I'm now using MS14a sensors. The MS14's don't appear to have the delay that the MS16's did (which essentially said "If I detect motion, delay for x minutes from now then shut off" and since it kept detecting motion within that timeframe, the lights didn't shut off until motion was NOT detected for more than x minutes. EXACTLY what I wanted...
With the MS14's however, it appears that they send an ON signal when motion is detected followed immediately by an OFF signal. I tried a macro that would turn on the appliance module when motion detected, wait 5 minutes and then turn it off, however my lights would blink on and off (It appears that the "delay" doesn't get reset when motion is detected, it just keeps delaying and the new motion causes a new copy of the macro to run so eventually I have several of the same macro running, motion gets detected and turns the lights on, then the delay finishes and turns the lights off almost immediately).