I am new to SAS and have run into a problem that I cannot solve. I am trying to count the number of unique codes in a group. Each group consist of multiple rows and the codes are pipe delimited in each cell. A sample of my dataset looks like this:
So in GROUP 1 there are 3 unique codes (231, 322, and 414) and in GROUP 2 there are 2 unique codes (231 and 114) There are 0 codes in GROUP 3. Can anyone tell me how to get SAS to give me an output dataset like this:
Using a DATA step, read up the record using just an INPUT ; statement (no variables specified), then parse _INFILE_, first to get your GROUP, and then iterate with SCAN through each CODES that is present and do an OUTPUT for each. Then use PROC SORT NODUPKEY with BY on GROUP CODES, and then PROC SUMMARY to get your _FREQ_ count with BY GROUP.
Suggested Google advanced search argument, this topic / post:
data step programming introduction site:sas.com
Message was edited by: sbb