DATA Step, Macro, Functions and more

Not able to resolve the warning

Reply
Regular Learner
Posts: 1

Not able to resolve the warning

WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.

 

I am getting the above warning for the below code. There are couple of macro variables in the title and I want them in different lines. I have other 9 titles hence all these needs to be accomodated in one title statement. I have used the escapecharacter '^' in the proc report. please help me in resolving this.

 

title1 %str("Report") ^n ("Listing of SAEs") ^n %str("&sitename") ^n %str("As of &cutoffdate") ^n %str("Total Number of SAEs = &sae");

 

Thanks,

Bala

Super User
Posts: 7,827

Re: Not able to resolve the warning

[ Edited ]
Posted in reply to Bala_geethu

Bala_geethu wrote:

WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.

 

I am getting the above warning for the below code. There are couple of macro variables in the title and I want them in different lines. I have other 9 titles hence all these needs to be accomodated in one title statement. I have used the escapecharacter '^' in the proc report. please help me in resolving this.

 

title1 %str("Report") ^n ("Listing of SAEs") ^n %str("&sitename") ^n %str("As of &cutoffdate") ^n %str("Total Number of SAEs = &sae");

 

Thanks,

Bala


Your title statement will look like this after macro resolution:

title1 "Report" ^n ("Listing of SAEs") ^n "content of sitenname" ^n "As of content of cutoffdate" ^n "Total Number of SAEs = content of sae";

As you can see, the ^n appear outside of the quoted strings, and that is not allowed. I suggest you build the string for the title statement first, preferably in a data step, and then store it in a single macro variable:

data _null_;
mytitle ="Report^nListing of SAEs^n&sitename.^nAs of &cutoffdate.^nTotal Number of SAEs = &sae.";
call symput('mytitle',trim(mytitle));
run;

title1 "&mytitle";

 

Edit: removed unnecessary length statement in data step.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,976

Re: Not able to resolve the warning

Posted in reply to Bala_geethu

Why are you using %str() function at all?  Please check through the macro guides and see how to use macro variables, as this breaks some fundamental rules of this.  To resolve your code:

title1 "Report^nListing of SAEs^n&sitename.^nAs of &cuttoffdate.^nTotal Number of SAEs=&sae.";

I would also point out, but not knowing your specs can't say for certain, that there are two things I would change in that report.  

Firstly there is the listing by sitename.  SAS includes a term by group processing which can apply to all parts, and this can automatically generate this kind of by grouping with:

proc report data=...;
  by sitename;
  title1 "Report";
  title2 "List of SAEs #byval1";
  title3...;
  columns...;
run; 

As you can see, no need to put all your title on one line and then break it up, just have multiple title statements, and use by in the proc report (or other procedure) and the keyword #byval or #byvar to get the by group information in the title.  Far simpler.

For the last title line, total number of SAEs, as that is data I would normally expect to see that as part of the report, not title, ie.:

Total Number of AEs:                                 55

AEgroup1                                             12
  AESubgroup1                                        3
  AESubgroup2                                        ...
Ask a Question
Discussion stats
  • 2 replies
  • 155 views
  • 0 likes
  • 3 in conversation