@Tango_Mike wrote: Thank you all for the help. The problem was a dataset step and then the dataset was also not sorted correctly. I appreciate the tips today!
For many purposes you can use a CLASS statement instead of BY to group values. The sort is then done internally. Output data sets would however have a _type_ variable to indicate the combination of the class variables used for any output record and the TYPE or WAYS statement, NWAYS proc option or CLASSDATA data set proc option may be used to control the combinations of class variables in the output.
... View more