BookmarkSubscribeRSS Feed
SAS_inquisitive
Lapis Lazuli | Level 10

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;

  

10 REPLIES 10
Astounding
PROC Star

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.

ChrisBrooks
Ammonite | Level 13

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...

novinosrin
Tourmaline | Level 20

@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. 🙂

ChrisBrooks
Ammonite | Level 13

@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"!

SAS_inquisitive
Lapis Lazuli | Level 10

Thank you all. @novinosrin Can you share that link?

ChrisBrooks
Ammonite | Level 13

@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.

art297
Opal | Level 21

@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

 

Reeza
Super User

If the paper doesn't cover it, also look into DOSUBL.

ChrisBrooks
Ammonite | Level 13

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...

Ksharp
Super User
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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 10 replies
  • 1974 views
  • 8 likes
  • 7 in conversation