Suggestion to Peter.C -- go easy -- clearly, the OP is looking for various options to achieve a specific result (generate a set / count of distinct variable values), although not necessarily within your personal interest area(s). Better to contribute when providing some idea, suggestion, or question (for clarification) -- rather than just being critical.
The SAS language is quite challenging and powerful, as some know and others have heard, so interest on the forum to increase one's arsenal of SAS solution techniques through self-training, formal education and discussion forums, is quite reasonable.
Scott Barry
SBBWorks, Inc.