Dear Phil, Here is the solution for your question, Hope it will helps you. data inds; input id $ los; cards; a 10 a 20 a 30 b 20 b 20 b 20 c 20 c 10 c 50 ; proc sort data = inds; by id; run; /* Sum by Group */ data outds1 (keep = id sumvar); set inds; by id; if first.id then sumvar = 0; sumvar + los; if last.id; run; /* Mean by Group */ data outds2 (keep = id meanvar); set inds; by id; if first.id then do; sumvar = 0; grpcnt = 0; end; sumvar + los; grpcnt + 1; meanvar = round(sumvar/grpcnt, .01); if last.id; run; Regards, SP Choudary.
... View more