BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Dingdang
Fluorite | Level 6


Hi,

I wanted to use a macro variable &var in the imagename like this:

ods graphics on /

reset=all imagename="ROC_&var";

I got this warning from log

WARNING: The IMAGENAME option or the output name contains invalid characters. ROC_interestrate will be used as the image name

          prefix.

ROC_interestrate is the name that I wanted for my graph. So this warning didnt really affect my result. But I am curious where I did sth. wrong. Can someone please help me?

Thank you very much in advance!

BR  Ding

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

I would suspect from the minimum information the macro variable is resolving with spaces after it, if you are sure there is no special characters.  Try %trim(&var.).  Maybe turn options mprint mlogic symbolgen; so you can see what it is resolving to.

View solution in original post

7 REPLIES 7
mohamed_zaki
Barite | Level 11

how do you assign the value to the &var.

share your code please

Dingdang
Fluorite | Level 6

hi

I use var as an input argument in a %marco(). The values of the var is sth. like interestrate, affordability. I just tried %trim(&var.) and still get the same warning.

BR  Ding

mohamed_zaki
Barite | Level 11

okay input argument to the macro,but share your code to help you further.

Dingdang
Fluorite | Level 6

hi

this is a part of the code:

%macro UV(data_in, var, var_class, data_out);

ods html close;

data tmp0;         
format variable $20.;
Variable="&var.";
run;

ods graphics on /
reset = all imagename = "ROC_&var";
ods select ROCCurve;

.....

%mend;

thanks very much!

BR  Ding

mohamed_zaki
Barite | Level 11

I am asking about the part when you assign the value to var and calling UV.

Give example of how you call the UV macro passing the argument to it.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I would suspect from the minimum information the macro variable is resolving with spaces after it, if you are sure there is no special characters.  Try %trim(&var.).  Maybe turn options mprint mlogic symbolgen; so you can see what it is resolving to.

Darrell_sas
SAS Employee

Yes, how do you assign 'var'?

For example, this doesn't cause a problem:

%UV(flurg, interstrate, class, foo);

So, what do you do?

And you might try adding the following code to macro UV:

data a;

imagename = "ROC_&var";

put imagename;

run;




SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 7 replies
  • 2616 views
  • 6 likes
  • 4 in conversation