I have a dataset containing binary variable DIAGNOSIS (0 & 1 for control and case) and the range of AGE is from 20 ~ 80. I'm interested to see the distribution (# of cases & controls) in various age groups with an interval of 10 years. (20~30, 30~40, 50~60, 60~70, etc).
Please suggest to me how to obtain suitable tables and plots to visualize my data.
PS: I have attached an example
Thanks in advance
Hello @mantubiradar19
The following instructions are based on the assumptions that the data is aligned like this:
Age | Diagnosis |
37 | 0 |
76 | 1 |
29 | 0 |
… | … |
Steps taken
IF ( 'Diagnosis'n = 1 ) RETURN 1 ELSE 0
IF ( 'Diagnosis'n = 0 ) RETURN 1 ELSE 0
'Cases'n + 'Controls'n
Sum [_ByGroup_] ('Cases'n) / Sum [_ForAll_] ('Cases'n)Controls %
Sum [_ByGroup_] ('Controls'n) / Sum [_ForAll_] ('Controls'n)Total %
Sum [_ByGroup_] ('Total'n) / Sum [_ForAll_] ('Total'n)
I hope this helps.
Best regards,
Petri
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.