You can use the NWAY option for this. Note that Proc means or summary will not calculate means for missing values, so you have to exclude the missing value. I have taken variable1_mean and median, You can include all the other variable in the VAR statement and also in the Mean and Median statements for the output. Please refer to the link below for more details on Proc means. https://www.9to5sas.com/proc-means/ data have;
input subject day group $9. variable1_Mean;
datalines;
2 0 placebo 2
1 0 treatment 1
3 0 treatment 2
2 1 placebo 2
1 1 treatment 1
3 1 treatment 1
2 2 placebo .
1 2 treatment 2
3 2 treatment 2
3 3 treatment 1
3 3 treatment 2
3 3 treatment 3
3 3 treatment 4
;
run;
proc summary data=have(WHERE=(variable1_Mean ^=.)) mean median nway;
class group day;
var variable1_Mean;
output out=want (drop=_type_ _freq_) mean=variable1_Mean
median=variable1_Median;
run;
... View more