BookmarkSubscribeRSS Feed
deleted_user
Not applicable
When I tried to invoke the macro function below, it throws an error saying
"%SYSEVALF function has no expression to evaluate...."

%macro concat_ctrl(contstr=,i=);
%do %while(&i < 32);
%let contstr = %sysfunc(cats(&contstr,%sysfunc(byte(&i))));
%put &contstr &i;
%let i=%eval(&i+1);
%end;
%mend concat_ctrl;
%concat_ctrl(contstr=%sysfunc(byte(0)), i=1);

But I am able to invoke the macro function above with difference values as below...

%macro concat_ctrl(contstr=,i=);
%do %while(&i < 72);
%let contstr = %sysfunc(cats(&contstr,%sysfunc(byte(&i))));
%put &contstr &i;
%let i=%eval(&i+1);
%end;
%mend concat_ctrl;
%concat_ctrl(contstr=%sysfunc(byte(65)), i=66);

Could you help me out to overcome this issue?
1 REPLY 1
martha_sas
SAS Employee
I do not have a complete explanation for you, but I believe your problem is that
byte(0) returns null, and sysfunc is getting a string with containing a null.

You can get the same error message submitting these two lines:

%let badstr=%sysfunc(cats(,1));
%put &badstr;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1541 views
  • 0 likes
  • 2 in conversation