Reputation: 147
I have a dataset with patients and their age of onset of certain diseases. I want to look at the frequency of these ages of onset relative to decade. However, some patients have multiple diseases, resulting in multiple ages of onset.
The data looks like this. If a patient does not have the disease, the age is 0.
IDNUM HOHTAge HOGDAge CelDAge
1 25 26 15
2 65 32 0
3 21 12 59
I was thinking I need to compile these into a single variable and create a frequency table with them, but this possible/ is there a better solution?
In the end, I want to do something like
IF AgeOnset LE 29 THEN AGEGROUP = 0;
ELSE IF 30 LE AgeOnset LE 39 THEN AGEGROUP = 1;
ELSE IF 40 LE AgeOnset LE 49 THEN AGEGROUP = 2;
ELSE IF 50 LE AgeOnset LE 59 THEN AGEGROUP = 3;
ELSE IF AGEOnset GE 60 THEN AGEGROUP = 4;
PROC FREQ; TABLES AGEGROUP;
Upvotes: 0
Views: 63
Reputation: 278
get your agegroup variable and then I like proc sql
proc sql;
create table agegroups as
select
count(case when HOHTAge>0 then 1 end) as HOHT_freq,
count(case when HOGDAge>0 then 1 end) as HOGD_freq
from dataset
group by AGEGROUP;
quit;
Upvotes: 1