I browsed through some articles on sample size calculation for comparative studies and I calculated as follows:

1. One-year prevalence in a previous epidemiological study for rural and urban users was 43.2% and 56.8%.

2. A 3-month prevalence found by me in the hospital was 56% rural and 44% urban substance users.

3. Using 95CI and 80% power, I used the formula available online for comparing two proportions; n = (Zα/2+Zβ)^2 * (p1(1-p1)+p2(1-p2)) / (p1-p2)^2

hence n = (1.96+0.842)^2 * (.432(1-.432) + (.56(1-.56)) / (.432-.056)^2 = 236 for each group.

I want to know if this is the right way.

Link- https://select-statistics.co.uk/calculators/sample-size-calculator-two-proportions/