I don't understand what you are trying to do. You want to impute missing value with median or just bring median into original dataset ? 1) if you want to impute missing value with median, try this: proc stdize data=have missing=median reponly; by cluster; run; 2)if you want to bring median value back into orginal dataset, try this: proc summary data=have; by cluster; var var; output out=median median=median_var; run; data want; merge have median; by cluster; run; 3)Last, if you just simply impute missing WITHOUT median ,try PROC MI. https://blogs.sas.com/content/iml/2020/12/02/score-external-logistic-model.html
... View more