SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
GGO
Obsidian | Level 7 GGO
Obsidian | Level 7

Good discussion - sorry I missed this one before starting a new one. I'm now convinced that %SYSFUNC() needs to see something between the open/close parens of the DATA STEP function. A NULL STRING, alone, will not get passed the ERROR of missing arguments.

 

This is a pity, since this in not intuitive in the macro (text generation) world, at least for me, and leads to inconsistency based on number of arguments passed to the DATA STEP function:

 

  • ONE argument - %SYSFUNC() will not support a minimal null string. EG, the %sysfunc(countw()) examples.
    • Just give %SYSFUNC() a little assistance in recognizing the null string, and you're back in business. EG, the %sysfunc(countw(%str())) examples. The null string argument is still valid. You just kinda need to force %SYSFUNC() to acknowledge it. This, to me, is not intuitive.
  • TWO or more arguments - %SYSFUNC() does fine with multiple null strings, since the comma, itself, provides that assist for recognizing null arguments. They were and remain valid. They're just easier for %SYSFUNC() to recognize when that comma is there. Again - not intuitive to me.

 

I would much rather have %SYSFUNC() recognize the open/close parens of the DATA STEP function as argument delimiters, in addition to the comma for multiple arguments, of course. Then it would not fail, in the absence of that awkward %str() assist, to recognize a single null argument.

 

Nice discussion.

 

 

sas-innovate-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

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
  • 15 replies
  • 4841 views
  • 4 likes
  • 7 in conversation