BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dipand
Quartz | Level 8

i have a sas job execution. This job must show an image in background. At the moment i don't see the image.

dipand_0-1627392148600.png

my code:

 

data _null_;
file _webout;
put '<!DOCTYPE html>';
put '<html>';
put '<head><title>Hello World!</title></head>';
put '<body>';
put "<h1>Hello %sysfunc(htmlencode(&MYNAME))!</h1>";
put '<img src="/sasgrid/files/image.png">';
put '</body>';
put '</html>';
run;

 

Maybe i must save the image in an particular path?
Can you help me?

 

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

The image file must be stored in a location where the web browser can find it, either with a fully qualified URL or a location relative to the HTML file you're viewing.

 

If running in SAS Studio or EG, the HTML file will be "downloaded" as a result but the image file will not, so your browser cannot find it.

 

A solution might be to embed the image inline (like SVG) as supported in HTML5. This is documented in the ODS HTML5 statement options...but it's trickier to do if you're relying on DATA step to build the HTML by hand.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

View solution in original post

2 REPLIES 2
ChrisHemedinger
Community Manager

The image file must be stored in a location where the web browser can find it, either with a fully qualified URL or a location relative to the HTML file you're viewing.

 

If running in SAS Studio or EG, the HTML file will be "downloaded" as a result but the image file will not, so your browser cannot find it.

 

A solution might be to embed the image inline (like SVG) as supported in HTML5. This is documented in the ODS HTML5 statement options...but it's trickier to do if you're relying on DATA step to build the HTML by hand.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
AllanBowe
Barite | Level 11
There are several approaches:

* host the image somewhere (as Chris says)
* embed an SVG
* Base64 encode the image (here's an online converter- https://base64.guru/converter/encode/image)
* embed the image as base64 in a seperate job and decode on the way out (this works great for STPs on SAS 9)
* Simply place the image in SAS Drive and reference it as a file with the _file URL parameter

For an example of loading images, sounds and other content you can check out this Mario game, that deploys easily to Viya: https://sasapps.io/sas-streamed-apps
/Allan
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 1381 views
  • 2 likes
  • 3 in conversation