Some self-diagnosis output can be generated by adding this statement to a DATA step, so you can see in your SASLOG the SAS-generated temporary variables for FIRST.<byvar_> and/or LAST.<byvar_>. This information will help diagnose the program's execution more visually. Basically, you are only going to "OUTPUT" the last-occurrence condition of both of your BY statement variables. So, then, if you have a requirement to generate observations for other "OR" conditions, you will need to code them in your IF (<expression1>) OR (<expression2) THEN <action>; statement. Scott Barry SBBWorks, Inc. Suggested Google advanced search argument, this topic / post: by group processing site:sas.com
... View more