I have this large data set comprising of over 1000 subjects and about 3000 variables which are ICD9 codes (Dx1- Dx3000).
Dx represents the ICD diagnosis codes for each visit and is represented here as 1-4
My dataset looks similar to this:
I would like to get the distinct disease count for each subject.
For example: subject 1 has 4 visits but 3 distinct diagnosis.
subject 2 has 4 visits and 4 distinct diagnosis
Thanks.
I have this large data set comprising of over 1000 subjects and about 3000 variables which are ICD9 codes (Dx1- Dx3000).
Dx represents the ICD diagnosis codes for each visit and is represented here as 1-4
My dataset looks similar to this:
I would like to get the distinct disease count for each subject.
For example: subject 1 has 4 visits but 3 distinct diagnosis.
subject 2 has 4 visits and 4 distinct diagnosis
Thanks.
1. proc transpose
2. proc freq by id
proc transpose data=myData out=codes;
by id;
var dx1-dx3000;
run;
proc sql;
create table counts as
select id, count(distinct col1) as nbCodes
from codes
group by id;
quit;
(untested)
Thank you so much!! Just what I needed and it worked perfectly well
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.