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
Hallo FreelanceReinhard,
thank you for the solution. It works and the rtf-file look like it is supposed to.
Best,
Jens
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";
Hallo FreelanceReinhard,
thank you for the solution. It works and the rtf-file look like it is supposed to.
Best,
Jens
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.
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.