BookmarkSubscribeRSS Feed
raycmove
Calcite | Level 5

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.

 

6 REPLIES 6
Reeza
Super User

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?

Astounding
PROC Star

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. ................................

raycmove
Calcite | Level 5

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;

 

 

Kurt_Bremser
Super User

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.

Patrick
Opal | Level 21

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?

raycmove
Calcite | Level 5

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.

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 6 replies
  • 1703 views
  • 0 likes
  • 5 in conversation