09-09-2017 01:54 PM
Is CALL EXECUTE used only in DATA _null_ step to generate SAS code? I am curious if it is used elsewhere.
data _null_; set sashelp.class; call execute(cats('this is test','=',name)); run;
09-09-2017 02:16 PM
CALL EXECUTE can be used only in a DATA step. It doesn't have to be a DATA _NULL_ step, but it is likely to be ... if the purpose of the DATA step is to generate the SAS statements that need to run next, it is unlikely that you want to save the data produced by the same step.
Experiment away. You will find errors as you go, but you will get the hang of it.
09-09-2017 02:21 PM
It's true that it is mostly used inside data _null_ steps but it's function is to generate SAS code so that's natural. If you want to learn more about Call Execute this paper is a good place to start http://www2.sas.com/proceedings/sugi22/CODERS/PAPER70.PDF - it's an oldie but still valid plus it was written by the great Ian Whitlock, a name many of us SAS veterans will recognise...
09-09-2017 03:33 PM
@ChrisBrooks Thank you for pointing to and sharing that article. It' amazing Ian's contributions are transcending generations. When I started my career as a SAS user 5 years ago, I was advised to basically read and understand every post of Ian's in SAS-L however I learned he wasn't posting anymore by then. Nevertheless, Art T gave me an exclusive link to all of Ian's posts and that's simply invaluable. So yeah, I really was intriuged to leave a comment as your suggestion to OP brought me a smile.
09-09-2017 04:22 PM
@novinosrin I had the great good fortune to meet Ian Whitlock once. I was introduced to him and a number of other SAS luminaries at SUGI 30 in Philadelphia way back in 2005 during the course of a very convivial lunch. Like so many other SAS geniuses (genii?) he was a very quiet, modest man and ever since whenever I've mentored novice SAS programmers I've always told them "If you want to understand data step programming read everything you can find by Ian Whitlock"!
09-09-2017 05:27 PM
@SAS_inquisitive I don't have that but if you click this link http://www.lexjansen.com/search/searchresults.php?q=ian%20whitlock you should find most, if not all, the papers he published over the years.
09-10-2017 10:56 AM
@SAS_inquisitive: It's not a link but, rather, an Excel workbook that contains links to all of Ian's SAS-L posts over the years. I'd publish it, but Ian has never given me permission to do so, so I haven't. However, I have no problem sharing it as long as the recipient agrees not to make it publically available.
Art, CEO, AnalystFinder.com
09-09-2017 08:09 PM
Good point @Reeza - the paper was written long before DOSUBL existed. There is a subtle difference between the two which was explained here https://communities.sas.com/t5/General-SAS-Programming/difference-between-dosubl-and-call-excecute/t...