Help using Base SAS procedures

Got "WARNING: Apparent invocation of macro xx not resolved." when using "%" in proc report

Reply
New Contributor
Posts: 3

Got "WARNING: Apparent invocation of macro xx not resolved." when using "%" in proc report

Need to put the "%" sign in a text string as the column header in the proc report, coded as below:

 

define col8 /display 'FEV1(L)/~FEV1(%PN)' &line. ................................

 

but got "WARNING: Apparent invocation of macro PN not resolved." 

 

Tried the solution provied at "http://support.sas.com/kb/54/193.html" to revise the code as

 

define col8 /display "FEV1(L)/~FEV1(%%PN)" &line. ................................

 

It is not working. The warning is still there. Any help is appreciated.

 

Super User
Posts: 19,855

Re: Got "WARNING: Apparent invocation of macro xx not resolved." when using "%"

You shouldn't get that with single quotes. 

 

Can you post the exact code submitted and log? 

Are you certain it's that line that's generating the error?

Super User
Posts: 5,516

Re: Got "WARNING: Apparent invocation of macro xx not resolved." when using "%"

It is a bit confusing whether you are using single quotes or double quotes.  The top example shows single quotes, but the revision that you switched to uses double quotes.

 

Reeza is right, that using single quotes should take care of it.  If you do need to use double quotes for some reason, the fix that you were reading about would apply the %STR function:

 

define col8 /display "FEV1(L)/~FEV1(%str(%%)PN)" &line. ................................

New Contributor
Posts: 3

Re: Got "WARNING: Apparent invocation of macro xx not resolved." when using "%"

Posted in reply to Astounding

The column header is "FEV1(L)/~FEV1(%PN)", I have tried all the following codes

 

define col8 /display 'FEV1(L)/~FEV1(%PN)' &line. ................................

define col8 /display "FEV1(L)/~FEV1(%PN)" &line. ................................

define col8 /display 'FEV1(L)/~FEV1(%%PN)' &line. ................................

define col8 /display "FEV1(L)/~FEV1(%%PN)" &line. ................................

define col8 /display "FEV1(L)/~FEV1(%str(%%)PN)" &line. ................................

define col8 /display "FEV1(L)/~FEV1(%str(%PN))" &line. ................................

 

They all show the "WARNING: Apparent invocation of macro PN not resolved."

 

Here I attached the whole part of proc report

 


%if &noval %then %do;

proc report data=final missing center nowd headline headskip spacing=4 formchar(2)='_' split = '~' ;
by SITEID SITEIDc;
where SITEID = "&_SITEIDchar";

column page trt01pn col1 col2 col3 avisitn col4 blk col5-col11;

define page /order order=internal noprint;
define trt01pn /order order=internal noprint;
define col1 /order "Planned~Treatment" &line. style(header)=[just=l] style(column)=[cellwidth=0.9in just=l] flow ;
define col2 /order "Subject~ID" &line. style(header)=[just=l] style(column)=[cellwidth=0.7in just= l] flow;
define col3 /order "Age/Sex/Race" &line. style(header)=[just=l] style(column)=[cellwidth=1in just=l] flow;
define avisitn /order order=internal noprint;
define col4 /order "Week" &line. style(header)=[just=l] style(column)=[cellwidth=0.9in just=l] flow ;
define blk /display "" &line. style(header)=[just=l] style(column)=[cellwidth=0.1in just=l] flow ;
define col5 /display "Date of~measurement" &line. style(header)=[just=l] style(column)=[cellwidth=0.9in just=l] flow ;
define col6 /display "Bronchodi-~lator type" &line. style(header)=[just=l] style(column)=[cellwidth=0.8in just=l] flow ;
define col7 /display "Quality~grade" &line. style(header)=[just=l] style(column)=[cellwidth=1in just=l] flow ;
define col8 /display 'FEV1(L)/~FEV1(%PN)' &line. style(header)=[just=l] style(column)=[cellwidth=0.7in just=l] flow ;
define col9 /display 'FVC1(L)/~FVC1(%PN)' &line. style(header)=[just=l] style(column)=[cellwidth=0.7in just=l] flow ;
define col10 /display "FEV1/~FVC" &line. style(header)=[just=l] style(column)=[cellwidth=0.5in just=l] flow ;
define col11 /display "Reversi-~bility (%)" &line. style(header)=[just=l] style(column)=[cellwidth=0.8in just=l] flow ;
compute before _page_ ;
line &line.;
endcomp;

compute after col2;
line ' ';
endcomp;

break after page/page;

compute after page;
line &line.;
endcomp;

run;
%end;

 

 

Super User
Posts: 7,849

Re: Got "WARNING: Apparent invocation of macro xx not resolved." when using "%"

In these lines:

define col8 /display "FEV1(L)/~FEV1(%%PN)" &line. 
define col8 /display "FEV1(L)/~FEV1(%str(%%)PN)" &line. 
define col8 /display "FEV1(L)/~FEV1(%str(%PN))" &line. 

replace the double quotes with single quotes. Only single quotes keep SAS from trying to resolve macro triggers.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Respected Advisor
Posts: 4,173

Re: Got "WARNING: Apparent invocation of macro xx not resolved." when using "%"

[ Edited ]

You may have reached the point where you need to break up your code and test individual bits and pieces to identify what really causes the issues.

 

Normally the first step is to "make things work" outside of any macro coding.

 

Below code worked for me.

%macro test();
  %if 1=1 %then
    %do;

      proc report data=sashelp.CLASS nowd;
        column Name;
        define Name / display 'FEV1(L)/~FEV1(%PN)' style(header)=[just=l] style(column)=[cellwidth=0.7in just=l] flow ;
      run;quit;

    %end;
%mend;

%test();

What does your &line. macro variable resolve to?

New Contributor
Posts: 3

Re: Got "WARNING: Apparent invocation of macro xx not resolved." when using "%"

Just found out the reason, the problem is from the "%PN" in the footnote. The solution is to add the footnote manually in the code but not from the standard marcos.

 

Thanks, folks.

 

Ask a Question
Discussion stats
  • 6 replies
  • 417 views
  • 0 likes
  • 5 in conversation