Hi guys,
suppose to have the following median age (Q1-Q3) by hospitals from a demographic table:
Hospital A Hospital B Hospital C
43(39-61) 55(41-78) 57(43-59)
How can I put the median overall with Q1-Q3 without calculating that on the entire cohort from data?
I have not the original data but only the final table.
Edit: what I would like to do is to give a single number (median and Q1-Q3) that represents all the Hospitals
Thank you in advance
You can't. That operation is not mathematically feasible. Because of the way the median is computed, you cannot estimate the overall median from the medians of the groups. For example, the following two data sets have exactly the same medians across all classes, but different overall medians.
data A;
input Group $ Value;
datalines;
A 1
A 2
A 3
B 2
B 4
B 6
;
proc means data=A median printalltypes ;
class Group;
var Value;
run;
data B;
input Group $ Value;
datalines;
A 1
A 2
A 3
B 4
B 4
B 6
;
proc means data=B median printalltypes ;
class Group;
var Value;
run;
@NewUsrStat wrote:
How can I put the median overall with Q1-Q3 without calculating that on the entire cohort from data?
I have not the original data but only the final table.
I really don't understand what you are saying, please describe in more detail.
You can't. That operation is not mathematically feasible. Because of the way the median is computed, you cannot estimate the overall median from the medians of the groups. For example, the following two data sets have exactly the same medians across all classes, but different overall medians.
data A;
input Group $ Value;
datalines;
A 1
A 2
A 3
B 2
B 4
B 6
;
proc means data=A median printalltypes ;
class Group;
var Value;
run;
data B;
input Group $ Value;
datalines;
A 1
A 2
A 3
B 4
B 4
B 6
;
proc means data=B median printalltypes ;
class Group;
var Value;
run;
You can do the mean of means if you know the number observations in each group.
Assume
Then the overall mean is
(N1*M1 + N2*M2 + N3*M3) / (N1 + N2 + N3)
The numerator is the sum of the variable. The denominator is the total number of observations.
Hi @NewUsrStat,
I think what you can say in general about the overall quartiles Q1, Q2 (median) and Q3 is that they are in the range of the corresponding group-specific quartiles:
39 <= Q1 <= 43 43 <= Q2 <= 57 59 <= Q3 <= 78
(assuming QNTLDEF=5 and that the given group-specific quartiles are exact).
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →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.