Hello,
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;
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.
Good luck.
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...
@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. 🙂
@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"!
Thank you all. @novinosrin Can you share that link?
@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.
@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
If the paper doesn't cover it, also look into DOSUBL.
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...
CALL EXECUTE() also can be used under SAS/IML. http://blogs.sas.com/content/iml/2015/01/14/global-statements-loops.html
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.