Apart from PROC SQL, if you wish to perform the action using DATA STEP, you may proceed like this: data All_Units_Results; input fault_code$; datalines; 20-1802 20-1803 20-1805 20-1803 20-1803 20-1802 20-1801 ; proc sort data=all_units_results; by fault_code; data Fault_Count; set All_Units_Results; by fault_code; if first.fault_code then fault_count=0; fault_count+1; if last.fault_code then output; run;
... View more