/***************************************************************************************************************** SAS file name: Dusubl_Function File location: _________________________________________________________________________________________________________________ Purpose: To demonstrate the use of the Dosubl Function Author: Peter Clemmensen Creation Date: 01/11/2018 This program supports the example page "Understanding the Dosubl Function in SAS" on SASnrd.com *****************************************************************************************************************/ /* A Simple Docubl Function Example */ data _null_; put proc means data=sashelp.iris mean noprint; where Species='Setosa'; var SepalLength SepalWidth; output out=Stats(where=(_STAT_='MEAN')); run; /* Dosubl Vs Call Execute */ /* Call Execute */ options nonotes; data _null_; put "1. This exeutes in the Data Step"; call execute("data _null_; put '2. This exeutes in Call Execute'; run;"); put "3. This exeutes in the Data Step"; run; options notes; /* Dosubl Function */ options nonotes; data _null_; put "1. This exeutes in the Data Step"; rc=dosubl("data _null_; put '2. This exeutes in Call Execute'; run;"); put "3. This exeutes in the Data Step"; run; options notes; /* What you can not do */ data x; rc=dosubl('data y; a=1; run;'); set y; run; data x; rc=dosubl("data y; a=1; call symputx('a', a); run;"); a=input(symget('a'), 8.); run;