Hello @Kc2,
I see two options:
You can obtain the nine statistics in one step, but in the form of a 3x3 matrix (rather than a row vector):
proc summary data=have;
class both knee hip;
var age;
ways 1;
output out=want0(drop=_type_ _freq_ where=(_level_=2)) median= p25= p75= / autoname levels;
run;
Then you could use PROC TRANSPOSE and/or a DATA step to restructure dataset WANT0, if necessary.
Alternatively, you can first prepare a view and then get the desired result directly (with a slightly different naming convention and order of variables, though):
data vhave / view=vhave;
set have;
hip =ifn(hip, age,.);
knee=ifn(knee,age,.);
both=ifn(both,age,.);
run;
proc summary data=vhave;
var hip knee both;
output out=want(drop=_:) median= p25= p75= / autoname;
run;
... View more