A t-test would be appropriate for a binary independent variable and continuous outcome, not the other way around. For a continuous predictor and binary categorical outcome I'd suggest logistic regression.

To help get you started, after logistic regression the p-value for the overall regression is returned as e(p). After -tabulate, chi2- it's returned as r(p). You can loop over variables using:

The "do something" is a bit tricky and it depends on what you're after. If you just want the p-values you could store them in a matrix. Otherwise you may need to create a temporary dataset, which is slightly irritating in this situation (but quite do-able).Code:`foreach var of varlist a b c { // a, b & c are your continuous independent variables logistic outcomevar `var' do something with e(p) } foreach var of varlist d e f { // d, e & f are your categorical independent variables tabulate outcomevar `var', chi2 do something with r(p) }`