Hi:
Proc MEANS is the procedure that springs to mind. The question however, is whether you want to find the means for D1 and D2 separately, or whether you also want to combine the two files together BEFORE you use PROC MEANS.
To simply concatenate the 2 datasets, a SET statement would be the most useful:
[pre]
data all_d;
set d1 d2;
run;
proc means data=all_d;
class g;
var vari;
run;
[/pre]
cynthia