BookmarkSubscribeRSS Feed
Bala_geethu
Calcite | Level 5

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

2 REPLIES 2
Kurt_Bremser
Super User

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2 replies
  • 4645 views
  • 1 like
  • 3 in conversation