Here's my macro, below. The variables var1, var2, var3, VR, and maxwt are not input to the macro, and are not on a file. They are intermediate results which are calculated inside the macro. When I execute in in SAS 9.3, I get a message like this:
1 var1 = &dcount1 * (&spop1/&refpr1)**2;
----
180
ERROR 180-322: Statement is not valid or it is used out of proper order.
Macro:
%macro confi (aart,dcount1,dcount2,dcount3,spop1,spop2,spop3,refpr1=0.53468238,refpr2=0.30153350,refpr3=0.16378412);
var1 = &dcount1 * (&spop1/&refpr1)**2;
var2 = &dcount1 * (&spop2/&refpr2)**2;
var3 = &dcount3 * (&spop1/&refpr3)**2;
VR = var1+var2+var3;
maxwt = max(&refpr1 &refpr2 &refpr3);
CI_low = (VR/ 2*&aart)) * cinv(0.025,2*(&aart**2)/VR);
CI_high = (( VR + maxwt**2) / (2*(&aart+maxwt)))* cinv(0.975, 2*(&aart+maxwt)**2/(VR + maxwt**2));
%put &aart CI_low CI_high;
%mend confi;
%confi (aart=1000, dcount1=20, dcount2=70, dcount3= 10. spop1=3000, spop2=3000, spop3=200);