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

Hallo,

 

I do not have much experience in creating automatic reports in SAS. I experienced a problem while creating a report. I use ODS RTF and would like to set a bookmark by a macro variable. However, it does not work out.

 

The layout of the bookmark should be "2.1." with varying numbers indicated by a macro variable in the first position.

 

I assign a macro variable by

 

%macro compute;
    %global table;
    %let table=2;
%mend compute;
%compute;

 

and call a SAS code that creates the rtf-file.

 

The bookmark is set by

 

ods rtf bookmark = '&table..1';

 

The problem is that it is not allowed to use the &-sign in the bookmark statement.

(The anchor value "&table..13.14" is not valid for the "RTF" destination; anchors cannot contain white space, control characters, or any of the following: "()<>[]{}/%&\". Anchor value will be ignored.)

Thank you for your suggestions to solve that problem.

 

Best regards

Jens

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JensK
Calcite | Level 5

Hallo

 

 

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hallo @JensK and welcome to the SAS Support Communities!

 

The issue is that macro variable reference &table is not resolved because of the single quotes surrounding it. (You've probably got a warning in the log: "Apparent symbolic reference TABLE not resolved.") If you use double quotes instead, &table will be resolved so that the compiler will see the value (2) stored in the macro variable rather than an invalid expression containing an ampersand.

ods rtf bookmark = "&table..1";
JensK
Calcite | Level 5

Hallo

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 2 replies
  • 1801 views
  • 2 likes
  • 2 in conversation