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

Hello,

 

In my data file I have a variable which contains the hypelinks https://xxxx.com/

I would like to export this varaible with proc export and have the ACTIVE hyperlink in my file.

Is it possible with SAS proc export? I can't find the option that can do that.

 

Thank you very much for your help!

Best regards,

Marie

1 ACCEPTED SOLUTION

Accepted Solutions
mklangley
Lapis Lazuli | Level 10

If you want the first observation omitted entirely, then use:

where monotonic() ge 2;

If that's not what you want, please post your data and desired output. Otherwise I'll just be guessing on what you want.

 

View solution in original post

9 REPLIES 9
ghosh
Barite | Level 11

Instead of using proc export try this Proc report solution using ods excel posted by @Cynthia_sas

 

https://communities.sas.com/t5/ODS-and-Base-Reporting/Hyperlink-from-ODS-Excel-to-external/td-p/5791... 

mklangley
Lapis Lazuli | Level 10

Here's an example using ODS EXCEL:

data have ;
    input clickable_link $ url $40.;
    datalines ;
    Google http://google.com
    SAS https://www.sas.com/en_us/home.html
    ;
run ;

ods excel file="/my_path/ods_excel_output.xlsx";
 
proc report data=have nowd;
    columns url clickable_link ;
    compute clickable_link;
        call define(_col_,'url',url );
        call define(_col_,'style','style={textdecoration=underline color=blue}');
    endcomp;
run ;
 
ods excel close;

Using the method found here: https://communities.sas.com/t5/ODS-and-Base-Reporting/Need-help-with-creating-clickable-Excel-formul...

 

Or also see this slightly less convenient approach using PROC EXPORT. (It works, but you need to double click on the link's cell to activate the hyperlink first.)  https://support.sas.com/kb/41/613.html

data temp1;
length mylink $ 50;
input mylink $;
datalines;
http://www.sas.com
;

proc export data=temp1 outfile='/my_path/proc_export_output.xlsx'
dbms=xlsx;
sheet='mylinks';
run;
SASdevAnneMarie
Barite | Level 11
Hello,
Thank you for youe answer!
I would like to put a hyperlink from second observation, when I do:
proc report data=have nowd;
columns url clickable_link ;
compute clickable_link;
if _N_^=1 then do;
call define(_col_,'url',url );
call define(_col_,'style','style={textdecoration=underline color=blue}');
end;
endcomp;
run ;
it doesn't work. 😞
Maybe you know some option?

Thank you very much!
mklangley
Lapis Lazuli | Level 10

If I'm understanding correctly, you want only the second observation from your data to be used? Try using monotonic() in a WHERE clause.

proc report data=have nowd;
    columns url clickable_link ;
    compute clickable_link;
        call define(_col_,'url',url );
        call define(_col_,'style','style={textdecoration=underline color=blue}');
    endcomp;
    where monotonic() = 2;
run ;

If my understanding is off-track, please include your data, code, and desired output.

SASdevAnneMarie
Barite | Level 11
Thank you!
I want from second to the last.
I don't want to put the hyperlink for the first observation.
mklangley
Lapis Lazuli | Level 10

If you want the first observation omitted entirely, then use:

where monotonic() ge 2;

If that's not what you want, please post your data and desired output. Otherwise I'll just be guessing on what you want.

 

SASdevAnneMarie
Barite | Level 11
Thank you!
That works!
SASdevAnneMarie
Barite | Level 11
Last quick question: do you, maybe, know why my hyperlinks work in Chrome and don't work in Explorer?
Thank you!
ballardw
Super User

Why not to use Export. Proc Export is concerned with values of data only. No appearance options, no links, no summaries, no border controls, no row controls. Just data. Since to have a Link associated with a value would in fact mean two "values" in a single "cell" it won't do that.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 9 replies
  • 2219 views
  • 2 likes
  • 4 in conversation