Is there a way in SAS to specify dynamic variable names in code?
i.e. use different variables on different observations based on the value of another variable?
I think the simplest solution would be to use VVALUEX function. It creates the variable name using the index, and then supplies it as an argument to the function -