I wrote the same code on Python. Maybe you could help me translate the same to SAS. The match rate is what my target value is. actual_rate is table 1, matrix_rate is table 2. If the value In actual_rate is higher than max of matrix_rate, I want the highest value of matrix_rate to be used. I think this code will help understand my problem a lot better. @mkeintz @FreelanceReinh @Ksharp @ChrisNZ match_rate = [] actual_rate = [31,53,25,61,44,165,311,233] #These are samples, actual data is bigger, 30-40 rows matrix_rate = [31,62,93,124,155,186,211,252,288] for i in range(np.size(actual_rate)): if actual_rate[i] > max(matrix_rate): match_rate[i] = max(matrix_rate) else: temp1 = [] for j in range(np.size(matrix_rate)): p = matrix_rate[j] - actual_rate[i] if (p >= 0): temp1.append(p) match_rate[i] = min(temp1) + actual_rate[I]
... View more