BookmarkSubscribeRSS Feed

Avoiding Warnings for User-Written Functions

Started ‎07-17-2019 by
Modified ‎07-17-2019 by
Views 2,200

If you have ever re-run the creation of a user-written function (proc ), you get a warning.

If you try to delete a user-written function that doesn't exist, you get a warning.

So, I came up with this macro that deletes the function if it exists in work.myfuncs.

 

 

 

%macro delete_function(function);

	%if %sysfunc(exist(WORK.MYFUNCS)) %then %do;

		PROC SQL noprint;
		   SELECT distinct _Key_ into :key
			  FROM WORK.MYFUNCS
			  WHERE _Key_ = "F.DATES.&function";

		%if &sqlobs = 0 %then %return;

		   delete FROM WORK.MYFUNCS
			  WHERE _Key_ = "F.DATES.&function";

		QUIT;

	%end;

%mend delete_function;

 

Version history
Last update:
‎07-17-2019 08:42 AM
Updated by:
Contributors

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags