A test of two binomial proportions in R, seems appropriate to test $H_0: p_1=p_2$ against $H_a: p_1 \ne p_2.$ The two estimated
proportions are $\hat p_1 = 40/200 = 0.20$ and $\hat p_2 = 200/800 = 0.25,$ so the observed proportions are slightly different.
However, prop.test
in R gives a P-value $0.1386 > 0.05 = 5\%,$
so the difference is not statistically significant at the 5% level.
prop.test(c(40, 200), c(200,800), cor=F)
2-sample test for equality of proportions
without continuity correction
data: c(40, 200) out of c(200, 800)
X-squared = 2.193, df = 1, p-value = 0.1386
alternative hypothesis: two.sided
95 percent confidence interval:
-0.11303578 0.01303578
sample estimates:
prop 1 prop 2
0.20 0.25
Note: (1) I did not use the continuity correction for the normal approximation in this test on account of the sample sizes over 100. (2) A similar test which you can try with hand computation is described on this NIST page.