BookmarkSubscribeRSS Feed
Ronein
Meteorite | Level 14

Hello
I want to create a sas macro varaible xx and I get an error.
/*ERROR: Function name missing in %SYSFUNC or %QSYSFUNC macro function reference.*/
/*ERROR: %EVAL function has no expression to evaluate, or %IF statement has no condition.*/

When I create macro var YY I don't get error.
What is the problem with xx?

%let fromdate=21775;/*This is sas value for date 14AUG2019*/

%let xx = %eval(%sysfunc(&fromdate.)-1);

%let yy = %eval(%sysfunc(today())-1);
/
3 REPLIES 3
Patrick
Opal | Level 21

Like the error message tells you you're using %sysfunc() without using a function.

Code like below should do:

%let xx = %eval(&fromdate.-1);
ed_sas_member
Meteorite | Level 14

Hi @Ronein 

 

The %SYSFUNC() function enables to use SAS functions with macro variables.

In your example, the %SYSFUNC() function enables to use the TODAY() function. Look at the difference:

 

Capture d’écran 2019-12-30 à 10.23.39.png

 

 

 

 

 

 

 

But in your example with xx, the %SYSFUNC() function is not associated with any SAS function. So that makes no sense.

The syntax should be just:

%let xx = %eval(&fromdate.-1);

Hope this help.

 

Kurt_Bremser
Super User

Maxim 1: Read the Documentation.

In this case, of the %SYSFUNC macro function. You will see that the first argument to %sysfunc has to be a function. Since &fromdate resolves to a literal and not a function name, your %sysfunc call fails.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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
  • 3 replies
  • 910 views
  • 0 likes
  • 4 in conversation