@Reeza wrote: The calculation the OP wants is ObservedValue - Mean(positiveValues) for all records wether positive or negative. Your code won't do that, the BY statement means that the Negative values would be handled independently.
I would not agree with this wording.
I would say that the OP wants ObservedValue - Mean (positive OUTCOMEs)
I would say that the negative OUTCOMEs would be handled independently by PROC STDIZE, which gives the proper result for the data which has OUTCOME='POSITIVE'.
... View more