BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djbateman
Lapis Lazuli | Level 10

I have some footnote text that I want to add to a table, but I am using at least 1 of 5 set footnotes as follows:

%let note1=Adverse event monitoring for treatment-emergent ~{super 99m}Tc-etarfolatide adverse events commences with dosing of ~{super 99m}Tc-etarfolatide and continues for 4 days.;

%let note2=Adverse events reported as 'possibly', 'probably' or 'definitely' related to investigational agent that occur beyond the 4-day reporting window are included in the ~{super 99m}Tc-etarfolatide safety reporting analyses.;

%let note3=Patients are counted once for each system organ class and for each preferred term.;

%let note4=Drug-related adverse events include those possibly, probably or definitely related.;

%let note5=Adverse events are coded in accordance with MedDRA v.15.1 Dictionary.;

I then use the footnotes in a macro call as follows:

%aeoutput(file=DR_SER,

tnum=14.3.5,

ttitle=%str(Frequency Table of Drug-Related Serious Adverse Events),

foot1=%str(&note1.),

foot2=%str(&note3.),

foot3=%str(&note4.),

foot4=%str($note5.),

whr=%str(ec20ae=1 & serious=1 & relate in (3,4,5)),

label=%str(Drug-Related Serious Adverse Event));

I have noticed that whenever I reference notes 2 or 4 that I get an error message in the log.

ERROR: all positional parameters must precede keyword parameters.

I have a feeling that it has something to do with the word "or" that occurs in each of those notes.  Is SAS trying to interpret that as an or ("|") operator?  If so, does anyone know of a work-around method to avoid this error message?

1 ACCEPTED SOLUTION

Accepted Solutions
djbateman
Lapis Lazuli | Level 10

I resolved my own question!  It wasn't the "or" that I originally thought was causing the problem.  It also had nothing to do with the macro parameter order.  It didn't like the commas that were in the notes 2 and 4.  When I took out the commas, the code ran smoothly with no errors.

View solution in original post

7 REPLIES 7
BHarmon
Calcite | Level 5

My guess is that when you defining the macro you are giving it more variables than you have listed. When defining macros SAS will either use the position or the keyword and it all depends on how you define it in the macro statement. For example

%Macro Test(A = 1, B, C);

...

%Mend;

A is a keyword parameter and B is a positional parameter. If you do %Macro Test(B, C, A = 1); then you shouldn't get this error. SAS does this so that say you have multiple positional variables and do the following:

%Macro Test(B, C, A = 1);

...

%Mend;

%TEST( , 2, );

So that B = NULL, C = 2 and A = 1.

Hope that helps.

djbateman
Lapis Lazuli | Level 10

BHarmon,

Thank you for your reply.  I have played around a bit with your suggestions, but I still get the same errors.  This is what the macro statement looks like:

%macro aeoutput(whr=%str(1=1), file=, tnum=, ttitle=%str(), foot1=%str(), foot2=%str(), foot3=%str(), foot4=%str(), foot5=%str(), label=%str());

And this is the error messages that results when I run the macro call as displayed in my original post:

48796 %aeoutput(file=DR_SER,

48797            tnum=14.3.5,

48798            ttitle=%str(Frequency Table of Drug-Related Serious Adverse Events),

48799            foot1=%str(&note1.),

48800            foot2=%str(&note3.),

48801            foot3=%str(&note4.),

ERROR: All positional parameters must precede keyword parameters.

48802            foot4=%str($note5.),

                 -----

                 180

ERROR 180-322: Statement is not valid or it is used out of proper order.

48803 whr=%str(ec20ae=1 & serious=1 & relate in (3,4,5)),

48804            label=%str(Drug-Related Serious Adverse Event));



Does this help clarify in any way?

djbateman
Lapis Lazuli | Level 10

Just to clarify, I did move the "whr" portion to the end of the macro statement, and that didn't make a difference.

djbateman
Lapis Lazuli | Level 10

I resolved my own question!  It wasn't the "or" that I originally thought was causing the problem.  It also had nothing to do with the macro parameter order.  It didn't like the commas that were in the notes 2 and 4.  When I took out the commas, the code ran smoothly with no errors.

LarryWorley
Fluorite | Level 6

Just an observation.  This illustrates an application where macro quoting functions might be helpful to prevent this kind of error without output modifying the presentaion:-)

LarryWorley
Fluorite | Level 6

Instead of '...output modifying the presentaion', I meant 'changes which modify the presentation output'

BHarmon
Calcite | Level 5

Glad to hear you found the problem.

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!

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.

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
  • 7 replies
  • 1360 views
  • 0 likes
  • 3 in conversation