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
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!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: