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

Hello,

I am creating a simple table in SAS and outputting in RTF format. The table has four columns: PROT SITE DIR COUNT. I want to assign a network directory path (e.g. a folder on my company's shared drive) to a value of DIR, then assign a hyperlink to that value with a label. The intent is to have output with click-able links that will take the user to the network path intended, rather than just displaying the raw network path as the value. I have done multiple searches and can only come up with solutions for adding hyperlinks in titles or footnotes.

Thanks,

Lucas

1 ACCEPTED SOLUTION

Accepted Solutions
Tim_SAS
Barite | Level 11

This example uses PROC REPORT. It calls the DEFINE subroutine to add a hyperlink to each value of "name". (The hyperlinks are bogus, of course.)

data;

   set sashelp.class;

  url = "http://www.sas.com";

run;

ods listing close;

ods rtf file="hyperlink.html";

proc report nowd;

col url name;

define url /noprint;

define name /display;

compute name;

    call define(_col_, "url", url || "/" || name);

endcomp;

run;

ods listing;

ods rtf close;

View solution in original post

4 REPLIES 4
Tim_SAS
Barite | Level 11

This example uses PROC REPORT. It calls the DEFINE subroutine to add a hyperlink to each value of "name". (The hyperlinks are bogus, of course.)

data;

   set sashelp.class;

  url = "http://www.sas.com";

run;

ods listing close;

ods rtf file="hyperlink.html";

proc report nowd;

col url name;

define url /noprint;

define name /display;

compute name;

    call define(_col_, "url", url || "/" || name);

endcomp;

run;

ods listing;

ods rtf close;

lbarwick
Quartz | Level 8

Thanks Tim. This works when I run your sample code, but when I try to apply it to my code I get the following error:

ERROR: Unrecognized attribute name in CALL DEFINE.

NOTE: Argument 2 to function DEFINE at line 1 column 7 is invalid.

NOTE: There were 1 observations read from the data set WORK.RENPENUP3.

My code is:

ods listing close;

ods rtf file='[file path]';

title [title];

proc report data=renpenup3 nowd;

col dir site;

define dir /noprint;

define site /display;

compute site;

    call define(_col_, "dir", dir || "/");

    endcomp;

    run;

ods listing;

ods rtf close;

The renpenup3 data set I am reading from contains:

PROT | SITE | DIR | COUNT

XXX01 | XXX02 | [location of file on my drive] 1

I should note value of DIR is generated from a macro.

Thanks,

Lucas

Cynthia_sas
Diamond | Level 26

Hi:

  The second argument to the CALL DEFINE statement cannot be "dir" -- it can only be "format", "style", or as Tim showed you: "url" -- it is the second argument that tells CALL DEFINE what type of change it is about to make.

cynthia

lbarwick
Quartz | Level 8

Ah, thank you Cynthia. I was confused about same name for variable and argument. It is working now.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 3549 views
  • 3 likes
  • 3 in conversation