the function you're looking for is
intck. when given two date values, it returns the number of specified boundaries between the two values.
if you've got actual date values, you'll probably want to use those. i assumed you didn't so there is some conversion from 200702 to '01FEB2007'd.
[pre]
data temp;
date1 = 200608;
date2 = 200702;
d1 = input(put(date1, 6.), yymmn6.);
d2 = input(put(date2,6.), yymmn6.);
format d1 d2 date9.;
months = intck('month',d1, d2);
run;
[/pre]
Message was edited by: RichardK
added link to sas documentation
trying cynthia's tip