I was wondering if it was possible to perform a ttest (proc ttest) over all variables in a dataset in SAS. Possibly through looping over the data?
Here’s what I have currently but it’s not running correctly:
data test;
set work.wisc;
array Avar(30) V1-V30;
do variable = 1 to 30;
proc ttest data = work.wisc;
class Diagnosis;
var Avar(variable);
end;
run;
Any help is much appreciated. Thanks!
Something like this may work. Calling the
&&name&i.in the loop will reference each variable name. You may need to make some adjustments within the proc ttest as I’m not familiar with that function.