This is a large dataset, including over 100k obs. What I need to do is to classify individuals into body system categories based on their icd-9 categories. For example, this is a sample code. if substr(dx{i},1,3) in ('080', '081', '082'), then mar_head=1 Therefore, I have generated 31 different categories. After that, I need to generate a frequency table of this population, if that can be listed in an order based on the frequency of each different cateogory. For example, lung diseases is the first major problem; head diseases is the second most frequent problem. That is what I expect. Since it is a large dataset, and there are so many categories. I use transpose. proc transpose data=sam1 out=samid; var mar_head--mar_gyne; by id; run; I then have a table generated with newid, previousid, and the name of formal variable, including mar_head, mar_colon. Then, I hope to get advice from you how to count the frequency of those variables, which is now listed under one column, called “name of formal variable”. I want to have a following table: Body system percent N Musculoskeletal 26.2% 12345 Respiratory 25.5% 12322 Neurological 24.8% 11112 Mental health 18.6% 9687 Respiratory 14.6% 9456 Eye Diseases 4.4% 3233 Digestive 4.3% 2459 Gynecological 6.2% 4562 All Other 10.3% 5688 I do not know how to do this. Also, I need to only count each individual once. Thank you for your advice
... View more