Hello all,
I was trying to create links internally based on the values of a variable but wasn't able to create a link when the word I wanted to create a link for is a string.
For example, say I have a variable "Text" as below and have information on different pages of a PDF document for each of the values.
obs Text
1 Apples
2 Grapes
3 Apples Oranges
4 Apples Oranges Grapes
5 Apples are good
I was able to create links when there is only one value (Apples or Grapes) but wasn't successful in creating links when there is some other text associated with the text I wanted to create the link or to create different links for each valid word (different links for Apples, Oranges in obs 3 or link to Apples in obs 4). Can someone please help me on how to get this right.
Thanks
Mmm, from experience links are a pain. I had a discussion on this type of thing some time back: https://communities.sas.com/thread/42000
I would assign each link a unique identifier in a datastep and use that rather than just text, e.g. L0001 = Apples, L0002=Grapes etc.
data have; input obs Text & $400.; cards; 1 Apples 2 Grapes 3 Apples Oranges 4 Apples Oranges Grapes 5 Apples are good ; run; data temp(drop=i temp text); set have; length t temp $ 400; do i=1 to countw(text); temp=scan(text,i); if temp='Apples' then temp=catx(' ','~S={url="http://www.wwe.com"}',temp); else if temp='Oranges' then temp=catx(' ','~S={url="http://www.sas.com"}',temp); t=catx(' ',t,temp); end; run; ods listing close; ods html file='x.html' style=sasweb; ods escapechar='~'; proc report data=temp nowd ;run; ods html close; ods listing;
Xia Keshan
Hi Xia,
Your example only works for HTML output but not for PDF.
Thanks
Contact with SAS Technical Support .
OR
Cynthia@sas might give you an answer.
Xia Keshan
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.
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.