Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Renaming hyperlinks in an email

Status
Not open for further replies.

dblan

MIS
Jul 6, 2007
58
US
Is there a way to rename a hyperlink in a SAS generated email?
For example I can run:
filename outbox email
subject="Report website"
to="someone@email.com"
type='text/html';

data _null_;
file outbox;
put ' ';
put "Here is the link to the reports website.";
put ' ';
put 'run;

and the hyperlink works fine, but I have some very long http addresses that I would like to rename.

I've tried changing the

put '
to

put '<a href=" Link</a>

but it hasn't worked.

Any ideas?
 
What happens when you try that second option that you said doesn't work?

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
The second option writes the text: " <a href=" Link</a> " in the email

I'm started to look at producing a html file with links on it and send the html file as the body of the email. However, I can't seem to figure out how to produce a html file with having a report in it. (meaning I don't want to define a data source, like data=sashelp.class).
Any ideas on how I might do that?

Thanks
Dave
 
You could do a step as you've done, but use ODS HTML around it...
Code:
ODS HTML file='c:\blah.htm';
data _null_;
  file print;

  put '<a href="[URL unfurl="true"]http://www.reports.com">Report[/URL] Link</a>';
  ...
  ...
run;
ODS HTML close;
That should get you on your way.

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
No worries.
If you want to get REALLY smart with you, you can use the STYLE=... option on the ODS statement and use a template to set your fonts, colours, headers etc.
Here's a basic template:-
Code:
ods path work.templat(update) sashelp.tmplmst(read) ;


/* Documentation on this process can be found at:- */
/* [URL unfurl="true"]http://support.sas.com/rnd/base/topics/templateFAQ/ODS91.pdf#pagemode=bookmarks[/URL] */

proc template;
   define style styles.pshtml;
      parent=styles.default;
      style SystemTitle from SystemTitle /
         font_face = "Arial, Helvetica, Sans Serif"
         font_size = 4
         font_weight = bold
         font_style = roman
         foreground = #000000
         background = #FFFFFF;

      style SystemFooter from SystemFooter /
         font_face = "Arial, Helvetica, Sans Serif"
         font_size = 3
         font_weight = bold
         font_style = italic
         foreground = #000000
         background = #FFFFFF;

      style SysTitleAndFooterContainer from SysTitleAndFooterContainer /
         font_face = "Arial, Helvetica, Sans Serif"
         font_size = 3
         font_weight = bold
         font_style = italic
         foreground = #FFFFFF
         background = #FFFFFF
         borderwidth = 0
         ;

       style Body from Body /
         font = ("Arial, Helvetica, Sans Serif")
         font_size = 2
         font_weight = medium
         font_style = roman
         foreground = #000000
         background = #FFFFFF
         leftmargin = 8px
         rightmargin = 8px;

      style RowHeader from RowHeader/
         font = ("Arial, Helvetica, Sans Serif")
         font_size = 2
         font_weight = bold
         font_style = roman
         foreground = #000000
         background = #99CCFF;

      style Header from Header /
         font = ("Arial, Helvetica, Sans Serif")
         font_size = 2
         font_weight = bold
         font_style = roman
         foreground = #000000
         background = #99CCFF;

      style Data from Data /
         font = ("Arial, Helvetica, Sans Serif")
         font_size = 2
         font_weight = medium
         font_style = roman
         foreground = #000000
         background = #FFFFFF
         bordercolor = #000000
         borderwidth = 1px;

      style dataemphasis from dataemphasis /
         borderwidth = 3px
         bordercolor = #000000
         background = #99CCFF
         foreground = #000000
         font_style = Roman
         font_weight = BOLD
         font_size = 2
         font = ("Arial, Helvetica, Sans Serif");


       style Table from Table /
         font = ("Arial, Helvetica, Sans Serif")
         font_size = 2
         font_weight = medium
         font_style = roman
         foreground = #000000
         background = #000000
         borderwidth = 2px
         bordercolor = #000000
         cellspacing = 1px
        ;
   end;

  edit Styles.pshtml as Styles.pshtml2;
  style body from body / backgroundimage='P:\Sales and Marketing\Marketing Library\Logos, photos and clipart\logos 2004\PSlogo_SASPDF.gif';
  end;

run;

Then you can use the following in ODS statement
Code:
ods html file="c:\blah.htm" style=pshtml;
...
...
ods html close;
There's also another way of specifying it if you're embedding images (sometimes I use this for producing long audit reports which have lots of tables and graphs (which are stored as GIFs) in one html report)
Code:
ods html path="c:\report"
         file="blah.htm"
         style=pshtml;
...
...
ods html close;

The second template I created in the proc template was basically the same as the first (it inherits all its properties from it), except I added in a gif image to use as a header. This was actually used to produce a nice PDF with the company logo/banner across the top, might work OK with HTML as well...
If you use this, be careful, and run tests, the recipient might not see the same thing that you sent, especially if they aren't set up to recieve HTML e-mails.


Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top