Again - why would you need/want to "require" a DATA step, if the task can be completed in fewer SAS programming statements and possibly more efficiently?
And, so, with a DATA step, you must first sort your data, and then use BY GROUP PROCESSING to identify FIRST. and LAST. conditions for your defined BY variable list and the .
Explore the available DOC -- see the GOOGLE search below.
Scott Barry
SBBWorks, Inc.
Suggested Google advanced search argument, this topic / post:
data step by group processing site:sas.com
... View more