I posted the other day about creating hyperlinks with ods and proc report. I was able to create the hyperlink and it is in the right most column of my report. The user does not want that extra column and asked if I could have the hyperlink embedded in the report_number variable. Can that be done? can I assign the variable value to the link and hide the column with the actual full link information?
Thanks,
Elliott
Yes, the formula part takes one part as text and one as the link.
Set them appropriately and you should be fine.
@Elliott wrote:
I posted the other day about creating hyperlinks with ods and proc report. I was able to create the hyperlink and it is in the right most column of my report. The user does not want that extra column and asked if I could have the hyperlink embedded in the report_number variable. Can that be done? can I assign the variable value to the link and hide the column with the actual full link information?
Thanks,
Elliott
In your previous question, a suggestion was made by @SuryaKiran to use a formula instead. That is the approach you can use if the URL is different than the text.
Hi:
This approach worked for me. I just used NOPRINT to hide the computed link and then used the CALL DEFINE on NAME instead.
ods html path='c:\temp' (url=none) file='hidelink.html';
ods excel file='c:\temp\hidelink.xlsx';
proc report data=sashelp.class;
column name age sex height href;
define name / display;
define href / computed noprint;
compute href / character length=100;
href = catt('https://nameberry.com/babyname/',name);
call define('name','url',href);
endcomp;
run;
ods _all_ close;
Cynthia
Cynthia, this has been helpful and I am getting the link on the correct variable but the link goes to C:\...\Local\Microsoft\Windows\Temporary\Internet Files\Content,Outlook\BSC00BHK\
It did not pick up the string from the LINK variable. The value in the LINK variable is the full address to the SharePoint folder starting with https://
this is my code:
proc report nofs data=work.zero_vol1 list;
title "Reports with No Error Volume";
column DT REPORT_NO REPORT_ID ERRS VOL COMMENTS LINK;
define DT / display;
define REPORT_NO / display;
define REPORT_ID / display;
define ERRS / style(column)=[tagattr='format:0'];
define VOL / style(column)=[tagattr='format:#,##'];
define link /computed noprint;
compute link ;
href=catt(link,'.html',REPORT_NUMBER);
call define('REPORT_NUMBER','url', href);
endcomp;
run;
I also get a note in the log that says:
NOTE: The computed variable LINK is also a data set variable.
NOTE: The output might not be as expected.
I am not sure if that is important on not.
Thank you very much for your help
Elliott
Can you show a screenshot of what you're seeing in Excel?
when I hover over the link this is what it shows
I tested this with an HTTPS link to my Sharepoint site and it worked fine - using SAS 9.4 TS1M5.
@Elliott wrote:
when I hover over the link this is what it shows
Cynthia's did make the link on the correct variable, and hid the actual variable that had the full http path. but the link that got created on the report no variable was to that location in the screen shot, not the sharepoint link.
I did try to change the variable name but the result was not correct..
the url looks like https://...just like any link to a sharepoint site.
I had this working with the full link on the right but the user does not want it that way, that is why I am trying to assign the hyperlink to the report no variable.
I get that. Can you post some fully reproducible code to see what you're getting? I can't run your code because no data. Mocking up some data would help with testing.
The only difference between Cynthia's code and yours that I see is that link is already a variable and she creates a new one, so I wonder if that's the issue. I wonder if it's setting link to missing which is then ., which then pushes it to your working directory, which is what that path looks like.
I kept playing with it, I have it working now.. the only thing is I would now like the report no to be in blue font with an underline so it is obvious it is a link.. how is that done? I assume it is with a style attribute of some kind.
Thanks, this is awesome
This user answer the question here:
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.