Post hoc chi squared testing

For my research I have three diagnostic groups (let's say Dx, Dy and Dz).
To analyse the difference of male:female proportions between the diagnostic groups I used a chi-squared test. This gave me one p value to observe that there was a significant difference.

I then want to look for pairwise comparisons between the groups. e.g. the proportion of male:female in Dx vs Dy, Dx vs Dz and Dy vs Dz. I'm unsure of how to do this.

I do not understand the question here. Can you explain the design a bit more? It is not clear if you used a Chi-Squared test and are asking about post hoc comparisons or are asking about using a Chi-square for post hoc comparisons.

Sorry not to be more helpful.

hello, sorry. I wrote this in a rush and when i read it back it wasn't very clear.... I've updated the original question. Hope this version is more clear.

Sorry to take so long getting back to you.

Can you supply some sample data and perhaps a bit of code.,
We need a reproducible example (reprex)
FAQ: How to do a minimal reproducible example ( reprex ) for beginners?

A handy way to supply sample data is to use the dput() function. See ?dput. If you have a very large data set then something like head(dput(myfile), 100) will likely supply enough data for us to work with.