I have var_1 to var_n, some are missing, now I need to find the smallest value. Once I know the min, then I need to find which variable achieves the min. I can write a loop to solve the problem. However, is there any function that can do the job in a simple way?
would you need to find the MIN of all the VAR_1 values, all the VAR_2 values, all the VAR_3 values?? Or, would you need to find the MIN on the row for grp=aaa and then the MIN for grp=bbb, etc? Or, do you need to find out the minimum value for ALL the variables across the entire dataset?
Also, should the missing (.) be treated differently from the zero (0) values??
You can probably do quite a bit with PROC MEANS if you are looking for the MIN value across the whole dataset or based on classification variables (like GRP). You might have to use the MIN function in a DATA step program if you wanted to find the MIN for an entire row or observation.
I am trying to find the min for each subject in grp. If one of var is missing, then I will not count, for example, min(aaa)=1, min(bbb=3). Also, given min(aaa)=1, then the function can tell me that it is corresponding to var_1. In R, this is very simple. I want to know if there is any function is SAS can make it easier to code.