As always, there is more than one right way do this... For a month/year period extraction I kinda like to use formatted dates and perform an alpha match (which may work also for less/great than comparisons). where put(date(),monyy7.) eq put(LAST_UPDATED,dtmonyy7.) Now, what happens here: date() returns the system date which is converted to text using the date monyy7. format = 'SEP2012' LAST_UPDATE is converted to text using the dtmonyy7. date/time format = 'SEP2012' And a alpha match is performed. Or, you could use the datetime() function instead (and use date/time dtmonyy7 format), which returns the system date an time: where put(datetime(),dtmonyy7.) eq put(LAST_UPDATED,dtmonyy7.) Or, if you're not after an exact match, using the date yymm7. format = '2012M09' where put(date(),yymm7.) gt put(datepart(LAST_UPDATED),yymm7.) Notice the use of the datepart function above to convert LAST_UPDATED as the used format requires strictly a date value (not date/time). More on SAS formats here: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a001263753.htm More on PUT function here: http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199354.htm Note: the use of date()/datetime() functions or &SYSDATE9 really depends on performance and how "accurate" you want the date to be. &SYSDATE9 evaluates at the beginning of the session, date()/datetime() at the moment the call is made to this functions. Performance wise, the macro &SYSDATE9 should be "nicer" as it is evaluated once and then is part of the code as a constant value. The function is called each time the where is evaluated. Of course this could be meaningless or meaningful depending on the data's volume. Cheers from Portugal. Daniel Santos @ www.cgd.pt
... View more