BookmarkSubscribeRSS Feed

Coding around changes to a user-written transformation in SAS/DI

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

When I create a transformation, the only code I put in Source Code is call to the macro which executes the code. That way whenever the code has gone through unit-testing, all the jobs which use that transformation don't have to be re-deployed.
However when the transformation acquires new options, as one of mine did yesterday, my usual approach has been to:

  • sigh
  • analyse the transformation to check the jobs which use it
  • redeploy the jobs

 

But now I have dozens of jobs that use the transformation, and I couldn't be bothered sighing. I knew that the majority of the jobs wouldn't need to modified, and would get by on the defaults; however the code needed to be aware of the newly created option names and not fall over if the job didn't create them.


The fix is really quite easy, thanks to %symexist. Does the macro exist? No? Then create it, and set it to the same default as the updated parameter requires.

 

 

%if %eval(not %symexist(history_type)) %then %do;
    %global history_type;
    %let history_type = %nrquote(H2);						/* Default, standard processing */
    %end;

The new jobs, with history_type defined via the updated transformation, simply bypass the logic. The old jobs, without it, create history_type and populate it.

 

 

I appreciate that it won't always be as simple as this, but it saved me a lot of time. And meant that I could go off for my lunch early.

Contributors
Version history
Last update:
‎07-17-2019 08:20 PM
Updated by:

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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