DATA LIST free
/alpha (f10.5) mdiff (f10.5) sd (f10.5) n1 (f10.5) n2 (f10.5). 
BEGIN DATA. 
.05 3.0 4.0 39 39
.05 6.0 10.0 60 45
END DATA. 

matrix.
get m /variables=alpha mdiff sd n1 n2  /missing=omit.
compute alpha=make(1,1,0).
compute mdiff=make(1,1,0).
compute sd=make(1,1,0).
compute n1=make(1,1,0).
compute n2=make(1,1,0).
compute alpha=m(:,1).
compute mdiff=m(:,2).
compute sd=m(:,3).
compute n1=m(:,4).  
compute n2=m(:,5).
end matrix.
COMPUTE power = 1 - NCDF.T(IDF.T(1-alpha/2,n1+n2-2),n1+n2-2,((mdiff)/sd)*SQRT((n1*n2)/(n1+n2))).
exe.
formats n1 (f7.0) n2 (f7.0) alpha (f5.2) mdiff (f5.2) sd (f5.2) power (f5.2).
variable labels n1 'Sample Size 1' /n2 'Sample Size 2' /alpha 'Alpha' /mdiff 'Mean Difference' /sd 'SD' /power 'Power'.
report format=list automatic align(center)
  /variables=n1 n2 alpha mdiff sd power 
  /title "Unpaired t-test power for given sample sizes" .
