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,453

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:

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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