I am using ods tagsets excelxp to output excel sheets. I would like to avoid using proc report because I already have the rest of the code written up without it. I have two issues:
1. I need to create a variable where the values hyperlink to specific webpages but the display is still that of the original variable. So for example, if the variable was gender, then I want the values to show as M/F but if clicked, it would hyperlink to a specific webpage.
2. the url is a combination of other variable values. so say that I have variables called webpage and pageno so then the url would be www.webpage.com/pageno . I have about 4-5 such variables that are put into the url but I can't get them to resolve right and get the correct url at the end.
Any help would be appreciated!
Can you show what you have attempted?
You say you don't want Proc Report. So how do you want to display the values? Proc Print? Tabulate? Something else?
Say the link is a combination of the site name and page no that are based off of existing variables form and id.
I have a macro that makes and outputs the link variable and I use the HYPERLINK function to embed the link into the display_link variable but have it print as the form name.
I apologize that the code is a mess, I've tried so many things that they've jumbled into one.
%macro link(lib, dat);
proc sql no print;
select near into :numvars
from dictionary.tables
where libmame="&LIB" and memname = "&DAT";
proc datasets library=&LIB;
modify &DAT;
%do i=1 %to &numvars.;
call symputx('form', put(form, $35.), 'G');
call symputx('id', put(pid, $5.), 'G');
Display_Link="=HYPERLINK(""https://&form.com/&id."", ""&form."")";
output;
%end;
run;
%mend;
%link(work, data);
ods tagsets.excelxp file=data.xls style=custonmjournal options(sheet_name='all IDs' row_repeat=1 ABSOLUTE_COLUMN_WIDTH = '10, 5' orientation='landscape frozen_headers='YES');
proc print data=data noobs label split'/'
style(column) = {fontsize=8pt}
style(header) = {fontsize=8py just=l};
var form id;
compute id;
urlstring= Display_Link;
call define(_col_, 'URL', urlstring);
endcomp;
run;
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 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.
Ready to level-up your skills? Choose your own adventure.