Another couple of things to try are (1) examining the output of PROC CONTENTS for the data set that was (supposedly) just sorted and (2) perform some type of BY processing using the sorted data set. PROC CONTENTS will indicate whether the data set is marked as sorted and the BY processing will detect whether any observations are out of order. As an example of BY processing, try: proc print data = all_patients; by date_add patient_num time_add con_code; run; just after the data set is sorted. Out of order observations will result in an ERROR message in the log. It is very unlikely that PROC SORT is not sorting. Rather, it is most probably the case that the data set is sorted but, for some reason such as BY variable type, it isn't sorted the way you are expecting.
... View more