If you are assigning a NUM variable value, then you are not able to use a BY statement. Also, anyway, there is no look-forward called function with the SAS DATA step approach.
Given the scenario you suggest and limitations, I would say the answer is no. Why the "same DATA step" requirement anyway? Suggest you exploit the SAS facilities without such strange limitations and control/processing specifications.
Scott Barry
SBBWorks, Inc.
Message was edited by: sbb