data hsb2; input id female race ses prog read write math science socst; datalines; 70 0 4 1 1 57 52 41 47 57 121 1 4 2 3 68 59 53 63 61 86 0 4 3 1 44 33 54 58 31 141 0 4 3 3 63 44 47 53 56 172 0 4 2 2 47 52 57 53 61 113 1 4 2 2 44 52 51 63 61 50 0 3 2 1 50 59 42 53 61 11 0 1 2 2 34 46 45 39 36 84 0 4 2 1 63 57 54 51 63 48 1 3 2 2 57 55 52 50 51 75 1 4 2 3 60 46 51 53 61 60 1 4 2 2 57 65 51 63 61 95 0 4 3 2 73 60 71 61 71 104 0 4 3 2 54 63 57 55 46 38 0 3 1 2 45 57 50 31 56 115 0 4 1 1 42 49 43 50 56 76 0 4 3 2 47 52 51 50 56 195 0 4 2 1 57 57 60 56 52 ; run; %macro dembplot(var,group=); proc sgplot data=hsb2; title "Boxplot of &var"; vbox &var /datalabel=id %if &group ne %then %do; category=&group %end; ; run; %mend; %dembplot(write); data mynumericvars; input variable $ @@; lines; read write math science socst ; run; data _null_; set mynumericvars; rc=dosubl(cats('%dembplot(',variable,')')); run; * The following examples are from the PharmaSUG article; * "A brief understanding of DOSUBL beyond CALL EXECUTE" by Ajay Sinha and M Chanukya Samrat; * see https://www.lexjansen.com/pharmasug/2020/QT/PharmaSUG-2020-QT-183.pdf for the full article ; * Showing the differences between CALL EXECUTE subroutine and DOSUBL function; * the DATA step is executed first and THEN call execute is called afterward; data _null_; put "one"; call execute('data _null_; put "two";run;'); put "three"; run; * dosubl executes the code immediately in a side session, and it doesn't wait until after the DATA step; data _null_; put "one"; rc = dosubl('data _null_; put "two";run;'); put "three"; run; * call execute has an error; * symget is not able to find the macro variable cnte; * the DATA step is executed first and THEN call execute is called; data BMW(keep=count); call execute(" data _null_; set sashelp.cars; where make='BMW'; totobs+1; call symputx('cnte',totobs); run;"); count=symget("cnte"); run; * dosubl executes correctly; * the statements are executed immediately, and the macro variable is created and passed immediately; data BMW(keep=count); rc=dosubl(" data _null_; set sashelp.cars; where make='BMW'; totobs+1; call symputx('cntd',totobs); run;"); count=symget("cntd"); run;