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
SAS Super FREQ

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.

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!

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.

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