In some analyses you may want to compare to groups, e.g. wages of women and men, or random assignment in an experiment. Suppose you have a continuous variable (e.g. –wage–) and a dichotomous variable (e.g. –gender–). In this case, there are different ways to analyse whether two groups are significantly different from each other:
1) Compare densities (from: Geary Behavioural Economics Blog):
kdensity wage if gender==1, addplot (kdensity wage if gender==0)
2) Two independent samples t-test (from UCLA): An independent samples t-test is used when you want to compare the means of a normally distributed interval dependent variable for two independent groups.
ttest wage, by(gender)
3) Wilcoxon-Mann-Whitney test (from UCLA): The Wilcoxon-Mann-Whitney test is a non-parametric analog to the independent samples t-test and can be used when you do not assume that the dependent variable is a normally distributed interval variable (you only assume that the variable is at least ordinal). You will notice that the Stata syntax for the Wilcoxon-Mann-Whitney test is almost identical to that of the independent samples t-test.
ranksum wage, by(gender)