Your SAS® session might terminate abnormally when you use PROC IMPORT or PROC EXPORT code with the DOSUBL function


Your SAS® session might terminate abnormally if the text string that is submitted with the DOSUBL function contains PROC IMPORT or PROC EXPORT code. The problem also occurs when you invoke a macro that contains PROC IMPORT or PROC EXPORT code from within the DOSUBL function.

The example code below illustrates the problem:

options mlogic symbolgen;
data list;
   fname="test";
   flg=0;
run;
%macro cretateMargeData(fname, flg);
   %if &flg=0 %then %do;
     proc import out=work.data
          datafile= "c:\&fname..csv"
          dbms=csv replace;
          getnames=yes;
          datarow=2;
     run;
   %end;
%mend cretateMargeData;
data _null_;
   set list;
   rc=dosubl('%cretateMargeData('||fname||', '||flg||');');
   put rc;
run;

The following circumvention uses CALL EXECUTE instead of the DOSUBL function that was shown in the DATA _NULL_ step above:

data _null_;
   set list;
   call execute('%cretateMargeData('||fname||', '||flg||');');
   put rc;
run;