BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
asludtke
Calcite | Level 5

I have a program that outputs multiple plots using SGPLOT and multiple XLSX output. I'm using an "<a href" in a title statement to link to the XLSX file. Within the title statement I'm resolving a macro variable. All works fine, until the macro variable as a " ' " (single quote) in the name and then the link breaks. My code looks like:

 

proc sgplot data=plotdata;
   title1 h=5 "Blind Sample Determination:" ;
   title2 underlin=1 italic color=blue "<a href='Data_&&analyte&i...xlsx'; title='Data Link' >Open Data Set</a>"; /*Link to XLSX file */

 

When the variable analyte="Triclosan" then the HTML a href output reads correctly:

<a href='Data_4433_TRICLOSAN.xlsx'; title='Data Link' >Open Data Set</a>

 

When the variable analyte="2,2',4,4'-TETRABROMODIPHENYLETHER" then the HTML output breaks at the single quote in the name:

<a href='Data_4433_2,2',4,4'-TETRABROMODIPHENYLETHER.xlsx'; title='Data Link'>Open Data Set</a>

 

I need the double quotes to resolve the analyte macro variable and can't seem to figure out how to get around this.

 

Any suggestions would be very much appreciated,
Amy

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

1-Quotes in file names are not the best idea.

2-Try replacing the single quote in the href with &apos;

3-Try using double quotes only: 

title2  "<a href=""Data_&&analyte&i...xlsx""; title='Data Link' >Open Data Set</a>";

View solution in original post

3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

1-Quotes in file names are not the best idea.

2-Try replacing the single quote in the href with &apos;

3-Try using double quotes only: 

title2  "<a href=""Data_&&analyte&i...xlsx""; title='Data Link' >Open Data Set</a>";

asludtke
Calcite | Level 5

Thanks, option 3 (double-double quotes) worked!

Amy

BrunoMueller
SAS Super FREQ

How about using the the LINK=option. then you have two different strings and it is easier to manage. See sample below.

title link="https://communities.sas.com" "Here we go";

proc sgplot data=sashelp.cars;
  vbar type;
run;

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