A programming sequence involving multiple DATA steps as an approach (on sorted observations) should work. You will need to consider using MERGE to "flag" PID instances that are candidates. Also, look at using a RETAIN stmt to capture and track your "first date" conditions, as well.
Attack the requirements/tasks one at a time, as you develop your SAS application program, considering that along the way you may have some adjustments that need to be made. Use DATA step diagnostic techniques, such as one or more:
PUTLOG '>diag-nn' / _ALL_;
placed in your program, with "nn" being unique for each instance -- this helps you learn / understand the SAS observation/variable values and condition as the program executes.
Lastly, you will find a wealth of information at the SAS support
http://support.sas.com/ website, including SAS-hosted product documentation and also supplemental technical/conference papers on related topics.
Scott Barry
SBBWorks, Inc.