BookmarkSubscribeRSS Feed
SASdevAnneMarie
Barite | Level 11

Hello experts,

I would like to write the hyperlink after the text like:

 

Information: hyperlink

But, when I run the code (see below), the result is:

Information (a lot of spaces) hyperlink

 

I can't find how to write the text and the adresse in the same line.

 

Thank you for your help!

 

OPTION NODATE NONUMBER;
OPTIONS PAPERSIZE=A4;
OPTIONS TOPMARGIN=0.5 in BOTTOMMARGIN=0.5 in LEFTMARGIN=0.5 in RIGHTMARGIN=0.5 in;
ODS NORESULTS;
ODS PDF FILE = "XXXXXX\TEST.pdf" dpi=1800;

data _NULL_;
	set SASHELP.CLASS(obs=1);
	declare odsout obj();
	obj.format_text( data: "Information:",
		overrides: " just=left color=green font_weight=bold font_size=8pt ");
obj.href(data:
	"Adresse", url: 'https://www.test.fr/', inline_attr:'color=blue');
Run;

ODS PDF CLOSE;

Best regards,

Marie

 

1 REPLY 1
mkeintz
PROC Star

If you want the obj.format_text  and the obj.href to output to the same line, I suspect you'll have to construct them as two cells in the same row of a table, as in:

data _NULL_;
  set SASHELP.CLASS(obs=1);
  declare odsout obj();
  obj.table_start();
    obj.row_start();
      obj.cell_start();
        obj.format_text( data: "Information:",overrides: " just=left color=green font_weight=bold font_size=8pt ");
      obj.cell_end();
      obj.cell_start();
        obj.href(data:"Adresse", url: 'https://www.test.fr/', inline_attr:'color=blue');
      obj.cell_end();
    obj.row_end();
  obj.table_end();
run;

I suspect there are options for the obj.table_start() method thiat will allow you to elminate table grid lines, and left-justify the entire table.

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 959 views
  • 0 likes
  • 2 in conversation