webgu 发表于 2012-10-14 18:52 
data test;
input date : yymmdd10. N;
cards;
You can use the format statement on date variable and summary on formatted values. There is no intermediate step needed.
data test;
input date : yymmdd10. N;
cards;
2012-1-01 8
2012-1-02 20
2012-2-04 9
2012-2-05 17
2012-2-17 34
;
run;
/*data test1;*/
/* set test;*/
/* ym=catx("-",year(date),month(date));*/
/*run;*/
/**/
/*proc means data=test1 sum mean;*/
/* class ym;*/
/* var n;*/
/*run;*/
proc means data=test sum mean;
class date;
var n;
format date yymm7.;
run;