Hi, I am trying to run the below code: %macro temp2;
/*proc reg data=REPAM_DIF_EXTEND_ECONS1 outest=test plots=none;*/
/*m0: model IO_high_newhpi=&repam_dif_econs. /SBC rsquare adjrsq dw vif;*/
%put &=model_vars.
&=repam_dif_econs.;
%do i=1 %to %sysfunc(countw(&model_vars.,%str( )));
%put &=i.;
%let var_remove=%str();
%do j=4 %to 0 %by -1;
%put &=j.;
%let var_remove=%sysfunc(catx(%str( ),&var_remove.,%scan(&repam_dif_econs.,%eval(5*&i.+&j.))));
%put &=var_remove.;
/* m%eval(5*&i.-&j.): model IO_high_newhpi=%sysfunc(transtrn(&repam_dif_econs.,&var_remove.,%str()))/ SBC rsquare adjrsq dw vif;*/
%end;
%end;
/*run;*/
/*quit;*/
%mend temp2;
%temp2; It produces the log: 25 GOPTIONS ACCESSIBLE;
26 %macro temp2;
27 /*proc reg data=REPAM_DIF_EXTEND_ECONS1 outest=test plots=none;*/
28 /*m0: model IO_high_newhpi=&repam_dif_econs. /SBC rsquare adjrsq dw vif;*/
29 %put &=model_vars.
30 &=repam_dif_econs.;
31 %do i=1 %to %sysfunc(countw(&model_vars.,%str( )));
32 %put &=i.;
33 %let var_remove=%str();
34 %do j=4 %to 0 %by -1;
35 %put &=j.;
36 %let var_remove=%sysfunc(catx(%str( ),&var_remove.,%scan(&repam_dif_econs.,%eval(5*&i.+&j.))));
37 %put &=var_remove.;
38 /* m%eval(5*&i.-&j.): model IO_high_newhpi=%sysfunc(transtrn(&repam_dif_econs.,&var_remove.,%str()))/ SBC rsquare
38 ! adjrsq dw vif;*/
39 %end;
40 %end;
41 /*run;*/
42 /*quit;*/
43 %mend temp2;
44 %temp2;
MODEL_VARS=HPIM_NSA_INDEX_NEWHPIb_yoy_l_11 ILO_UE_Qb_yoy_l_11 MIGb_bob_l_12 TOT_HH_DTI_EX_SLb_l2
REPAM_DIF_ECONS=HPIM_NSA_INDEX_NEWHPIb_yoy_l_11 ILO_UE_Qb_yoy_l_11 MIGb_bob_l_12 TOT_HH_DTI_EX_SLb_l2
HPIM_NSA_INDEX_NEWHPIb_yoy_d_l11 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l12 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l13 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l14
HPIM_NSA_INDEX_NEWHPIb_yoy_d_l15 ILO_UE_Qb_yoy_d_l11 ILO_UE_Qb_yoy_d_l12 ILO_UE_Qb_yoy_d_l13 ILO_UE_Qb_yoy_d_l14
ILO_UE_Qb_yoy_d_l15 MIGb_bob_d_l12 MIGb_bob_d_l13 MIGb_bob_d_l14 MIGb_bob_d_l15 MIGb_bob_d_l16 TOT_HH_DTI_EX_SLb_d_l_2
TOT_HH_DTI_EX_SLb_d_l_3 TOT_HH_DTI_EX_SLb_d_l_4 TOT_HH_DTI_EX_SLb_d_l_5 TOT_HH_DTI_EX_SLb_d_l_6
I=1
J=4
ERROR: %SYSEVALF function has no expression to evaluate.
VAR_REMOVE=HPIM_NSA_INDEX_NEWHPIb_yoy_d_l15
J=3
2 The SAS System 10:41 Friday, August 13, 2021
VAR_REMOVE=HPIM_NSA_INDEX_NEWHPIb_yoy_d_l15 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l14
J=2
VAR_REMOVE=HPIM_NSA_INDEX_NEWHPIb_yoy_d_l15 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l14 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l13
J=1
VAR_REMOVE=HPIM_NSA_INDEX_NEWHPIb_yoy_d_l15 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l14 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l13
HPIM_NSA_INDEX_NEWHPIb_yoy_d_l12
J=0
VAR_REMOVE=HPIM_NSA_INDEX_NEWHPIb_yoy_d_l15 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l14 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l13
HPIM_NSA_INDEX_NEWHPIb_yoy_d_l12 HPIM_NSA_INDEX_NEWHPIb_yoy_d_l11
I=2
J=4
ERROR: %SYSEVALF function has no expression to evaluate.
VAR_REMOVE=ILO_UE_Qb_yoy_d_l15
J=3
VAR_REMOVE=ILO_UE_Qb_yoy_d_l15 ILO_UE_Qb_yoy_d_l14
J=2
VAR_REMOVE=ILO_UE_Qb_yoy_d_l15 ILO_UE_Qb_yoy_d_l14 ILO_UE_Qb_yoy_d_l13
J=1
VAR_REMOVE=ILO_UE_Qb_yoy_d_l15 ILO_UE_Qb_yoy_d_l14 ILO_UE_Qb_yoy_d_l13 ILO_UE_Qb_yoy_d_l12
J=0
VAR_REMOVE=ILO_UE_Qb_yoy_d_l15 ILO_UE_Qb_yoy_d_l14 ILO_UE_Qb_yoy_d_l13 ILO_UE_Qb_yoy_d_l12 ILO_UE_Qb_yoy_d_l11
I=3
J=4 As seen in the log, the code is generating the desired output, but it is also generating the error in the mentioned in the title, in spite of the absence of a %sysevalf function. I previously had a %sysevalf function in the code, which was suggested when trying to troubleshoot some other now resolved issue, and the error first arose when I ran it then. However, since returning to using the %eval() function, the error is still generated. I have restarted the session, tried the code in a new macro, tried the macro in a new program in the sas project, and tried running the magic string, but the error still persists. I have read on some similar threads that such an error can arise from the macro language trying to parse %str( ) in %sysfunc(catx( )) or %scan( ), but I need the string to be delimited %str( ) for my purposes. I don't know how to fix this, so any help would be greatly appreciated. Cheers, Douglas
... View more