@pinkyloop wrote: Thank you so Much!
@PaigeMiller's solution is one demonstration of an extremely powerful tool in SAS: Formats. Almost any grouping that needs to be done based on a single variable should at least consider the use of a format instead of adding a variable.
The groups created by formats are generally honored by most analysis, reporting and graphing procedures. So they can be extremely handy for examining data behavior. You can create multiple formats and see the results by just changing the format associated for use in a procedure.
Also if you have lists that change occasionally, think store, building name, teacher it can be easier to modify a format to use the current association then to modify data sets.
And the flip side of the format, the informat (invalue statement in Proc Format) can be used to read data into consistent forms or identify data entry errors or unexpected values.
... View more