DATA Step, Macro, Functions and more

how do i mask a statement

Reply
Frequent Contributor
Posts: 115

how do i mask a statement

I have a footnote "%s: percentage of successful attempts".

 

if i use %nrstr(&footnote.) where footnote sontains "%nrstr(&footnote.)"

 

i get the following warning.

WARNING: Apparent invocation of macro S not resolved.

 

How can i mask this

Super User
Posts: 17,780

Re: how do i mask a statement

[ Edited ]

Use single quotes instead of double is a quick way.

 

In single quotes SAS won't try and resolve the macro, in double quotes it would. If you also needed to include a macro variable in your footnote this wouldn't work. 

Frequent Contributor
Posts: 115

Re: how do i mask a statement

It was not in quotes for example:

 %put footnote           = <%nrstr(&footnote.)>;

Super User
Super User
Posts: 7,392

Re: how do i mask a statement

So, can you provide some example of what it is your doing.  Why have the footnote in a macro variable, normally there would be lots of footnotes, so easier to store them in a dataset, then call it from there:

data _null_;
  set footnotes;
  call execute(cat('footnote',strip(put(_n_,best.)),' j=l "',strip(footnote),'";'));
run;
Frequent Contributor
Posts: 115

Re: how do i mask a statement

I have a dataset which has all footnotes for each table and importing the dataset for each particular program and calling them

call symput('footnote',%nrbquote(strip(footnote))); in the datastep then i am using %put footnote           = <%nrbquote(&footnote.)>; 

Super User
Super User
Posts: 7,392

Re: how do i mask a statement

Yes, so you could try the datastep I provided above, to simply generate the statements from the datastep - avoid all the macro variables and other processing.

Super User
Super User
Posts: 6,498

Re: how do i mask a statement

Can you post actual SAs code that replicates the error message?  It is unclear if you are talking about the FOOTNOTE statement or the creation of a macro variable named FOOTNOTE or expanding the reference to a macro varaible named FOOTNOTE.

Ask a Question
Discussion stats
  • 6 replies
  • 348 views
  • 2 likes
  • 4 in conversation