Art-I think you are getting there but when I ran the code it didn't seem to function properly (or it return no values) After some fiddling I came up with this.. proc sql; select sum(1) as counter, input(compress(put(a.year,8.)||put(a.month,8.)),YYMMN6.) as month2 INTO :count1, :month1 from CHILLE.DEVICE_DAYS as A group by calculated month2 having counter=10 and Max(year) and max(month) ORDER BY month2 DESC; quit; That gives me the last month in a macro variable that I need. Not the most elegant solution but works for now.. Thanks for your help. Lawrence
... View more