BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,
I have 2 questions more.

1) How to put shortcut (link) to my e-mail in footnote ?
2) How to show pop-up window with text "No data..." if file in "_val_" link does not exist ?

Example code:

/****************************/
Data X;
Input Letters $1.;

Cards;
A
B
C
D
E
F
;
Run;


Proc Template;
Define Table My_HTML;
Column Letters;

Define Letters;
Just=C;
Cellstyle _val_ = 'A' as {url= "C:\Temp\File_1.jpg"},
_val_ = 'B' as {url= "C:\Temp\File_2.jpg"},
_val_ = 'C' as {url= "C:\Temp\File_3.jpg"},
_val_ = 'D' as {url= "C:\Temp\File_4.jpg"},
_val_ = 'E' as {url= "C:\Temp\File_5.jpg"},
_val_ = 'F' as {url= "C:\Temp\File_6.jpg"};
End;

End;
Run;

ODS HTML BODY="C:\Temp\MY_FILE.html" Style=MAGNIFY;

TITLE "SHORTCUTS";

Data _null_;
Set X;
File print Ods=(Template='My_HTML');
Put _ods_;
Run;
Footnote ' ';
Footnote1 COLOR="BLACK" JUSTIFY=LEFT HEIGHT=2.0 "AUTHOR:";
Footnote2 COLOR="BLACK" JUSTIFY=LEFT HEIGHT=2.0 "AUTHOR@CONTACT_MAIL.PL";
ODS HTML CLOSE;

/****************************/

Thanks for help...
13 REPLIES 13
deleted_user
Not applicable
in online doc at : http://support.sas.com/onlinedoc/913/getDoc/en/odsug.hlp/a002569317.htm and http://support.sas.com/onlinedoc/913/getDoc/en/odsug.hlp/a002569341.htm the example suggests you should add

, 1 as {url= "a default error message popup.jpg"}

before the
; end;


Hope it works for you.

PeterC
deleted_user
Not applicable
It's not working 😞

Any more ideas ?
Kevin_SAS
SAS Employee
I think the previous poster thought that you wanted a different image to appear if you had a missing value in your data, not if the image file was missing. This is much more difficult. Browsers generally don't let you check for the existence of files; however, there is a way around this if you are accessing your reports from a web server. The following code should allow you to do what you want.

Use this cellstyle-as statement:

Cellstyle _val_ = 'A' as {url= "javascript:openImage('File_1.jpg')"},
_val_ = 'B' as {url= "javascript:openImage('File_2.jpg')"},
_val_ = 'C' as {url= "javascript:openImage('File_3.jpg')"},
_val_ = 'D' as {url= "javascript:openImage('File_4.jpg')"},
_val_ = 'E' as {url= "javascript:openImage('File_5.jpg')"},
_val_ = 'F' as {url= "javascript:openImage('File_6.jpg')"};

Add this to your ODS HTML statement:

headtext=""

Then create a file called openImage.js in the same directory as your report with the following content:

function openImage(url)
{
var req = window.XMLHttpRequest ? new XMLHttpRequest() :
new ActiveXObject('Microsoft.XMLHTTP');

req.onreadystatechange = function imageExists()
{
if ( req.readyState == 4 )
{
if ( req.status == 200 )
location.href = url;
else
alert('No Data');
}
}

req.open('get', url, true);

try { req.send(null) } catch ( e ) { }
}

As I mentioned, this will only work if the files are being served by a web server.
deleted_user
Not applicable
as the handling for a missing image requires that a file exists (openImage.js as proposed), is there much functional difference or reliability difference between having a default image, and having code to detect the absence of an normal image?
Is it just the distinction of seeing a popup, versus an (unusual) image?

PeterC
deleted_user
Not applicable
Hello everyone,
I still have problems with Footnote and Title in ODS and I have some more questions to using them.

My questions is:
1) In Title1 I have good image, but in Title 2 I have image with Hyperlink and image in Title2 is arounded by purple border. How to remove this border ??? I used options “noborder”, “bordercolor” and nothing is happend.

2) How to justify (resize) Image from border to border (from left to right) ?

3) If we uncomment Title3 then Title1 and Title2 moving to left and I can’t move theme to CENTER position? What happened here ?

4) Last question: how to move My footnote to bottom of Page ?


Thanks for help…

Example code:
/**********/
Data X;
Input Letters $1.;

Cards;
A
B
C
D
E
;
Run;

Proc Template;
Define Table My_HTML;
Column Letters;

Define Letters;
Just=C;

Cellstyle _val_ = 'A' as {url= "C:\Temp\File_1.jpg"},
_val_ = 'B' as {url= "C:\Temp\File_2.jpg"},
_val_ = 'C' as {url= "C:\Temp\File_3.jpg"},
_val_ = 'D' as {url= "C:\Temp\File_4.jpg"},
_val_ = 'E' as {url= "C:\Temp\File_5.jpg"};
End;

End;
Run;

ODS escapechar='^';
ODS HTML BODY="C:\Temp\MY_FILE.html" Style=MAGNIFY;

TITLE1 JUSTIFY=CENTER '^S={preimage="C:\line.GIF" }';
TITLE2 JUSTIFY=CENTER '^S={preimage="C:\image.GIF" }';



/*TITLE3 JUSTIFY=LEFT '^S={preimage="C:\Home.GIF"}'*/
/* JUSTIFY=CENTER font='Times New Roman' height=20pt "SHORTCUTS" */
/* JUSTIFY=RIGHT '^S={postimage="C:\Home.GIF"}';*/

Footnote10 "My footnote";

Data _null_;
Set X;
File print Ods=(Template='My_HTML');
Put _ods_;
Run;

ODS HTML CLOSE;
Olivier
Pyrite | Level 9
For question 4, there is no "bottom" in HTML files, since they don't have size, pages or limits.

For image and links concerns (question 1), maybe BORDER=0 will do the trick.

Hope it helps.
Olivier
deleted_user
Not applicable
Unfortunately BORDER=0 not working. Every options showing like a normal title.

For example:
TITLE2 BORDER=0 JUSTIFY=CENTER '^S={preimage="C:\image.GIF"}';

is display like that:
BORDER=0
PICTURE


For question 4 You have right. But if i have simple only one ROW then I want see my footnote on the bottom on the screen. I don't know how move him down.

Any more ideas ?
Thanks...
Olivier
Pyrite | Level 9
Can you please try something like :

TITLE2 JUSTIFY=CENTER '';

For question 4, I would try something like :

FOOTNOTE1 "

My footnote text" ;

The

paragraph signs imply "carriage returns" in the HTML file.
I hope it works, since I can't test any syntax today.

deleted_user
Not applicable
Hi Olivier,
BIG thanks for Your help.

TITLE working perfect
FOOTNOTE unfortunately not 😞

Temporary I used something like this:
TITLE1 " ";
TITLE2 " ";
.
.
.
TITLE10 "My Footnote"

..but this is very stupid and insufficient solution 🙂
Olivier
Pyrite | Level 9
Hi Kosa.

I've got something for the "further" footnote : you have to include
(HTML blank lines) at the beginning of the FOOTNOTE text. But SAS thinks that any HTML instruction has to be protected, as if "
" was a text that you wanted to see in your footnote.
To bypass this behaviour, you have to add a parameter in the style definition, called ProtectSpecialChars=OFF. Just a short sample to show you how it works :

PROC TEMPLATE ;
DEFINE STYLE styles.default_foot ;
PARENT = styles.default ;
STYLE SystemFooter FROM TitlesAndFooters
"Controls system footer text." /
font = Fonts('TitleFont')
PROTECTSPECIALCHARS = OFF
;
END ;
RUN ;
ODS HTML FILE = "c:\temp\test.htm" STYLE = default_foot ;
FOOTNOTE1 "



My footnote" ;
PROC PRINT DATA = sashelp.class (OBS = 3) ;
RUN ;
FOOTNOTE ;
ODS HTML CLOSE ;
deleted_user
Not applicable
Power of Knowledge :)))

Your code Olivier working GREAT. Thanks, thanks, thanks.

At last, I must find solution how to use pop-up window (using Java from Kevin code) and my Page will be finished;
I never used Java before and I don't know how to begin write this 🙂

Thanks again for Your help Olivier,
thanks everyone.
Olivier
Pyrite | Level 9
Hi Kosa.
Since I'm not really good at Javascript either, I was thinking that maybe we could do this with SAS (checking if the file does exist or not ; displaying the "popup" text just using standard HTML features included in the A tag (which is used for links)...

Here is your first example, transformed into a Print procedure using a format.

DATA x;
INPUT letters $1.;
CARDS;
A
B
C
D
E
F
;
RUN;
PROC FORMAT ;
VALUE $links
'A' = "C:\Temp\File_1.jpg"
'B' = "C:\Temp\File_2.jpg"
'C' = "C:\Temp\File_3.jpg"
'D' = "C:\Temp\File_4.jpg"
'E' = "C:\Temp\File_5.jpg"
'F' = "C:\Temp\File_6.jpg"
;
RUN;
DATA work.links ;
SET x ;
/* test if the file exists for each value */
IF FILEEXIST(PUT(letters,$links.)) THEN
value = ""!!letters!!"" ;
ELSE value = ""!!letters!!"" ;
RUN ;
ODS HTML BODY="C:\Temp\MY_FILE.html" STYLE=MAGNIFY;
TITLE "SHORTCUTS";
PROC PRINT DATA = work.links LABEL NOOBS ;
VAR value ;
LABEL value = "Click on shortcut to display the image" ;
RUN ;
ODS HTML CLOSE;

I hope it will be of any help.
Olivier
deleted_user
Not applicable
Yessssssssssssss...

Your solution is sufficient for My needs.
Thanks again. This is really great code.

Thank You Olivier for Your help.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 13 replies
  • 1032 views
  • 0 likes
  • 3 in conversation