BookmarkSubscribeRSS Feed
Arpit_Agarwal
Fluorite | Level 6

Hi All,

 

I was able to place a png & htm file after running following code,

 

%let name=bar1;
FILENAME odsout "&_SASWS_/charts";   /* This allows me to output bar1.png being created in my home directory under charts */
goptions xpixels=480 ypixels=300 device=png noborder cback=white;
ods listing close;
ods HTML path=odsout body="&name..htm" style=minimal;
title;
footnote;
proc gchart data=running; vbar Date / sumvar=Mile_3 clipref frame type=sum
 coutline=black raxis=axis1 maxis=axis2
 des="" name="&name.";
run; quit;

 

Now how do I pull/read/access/fetch the file BAR1.png or BAR1.htm back in my proc report if I intend to email this image alongwith proc report output?

 

proc report data = running STYLE = [PREHTML = %UNQUOTE(%STR(%')
 <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>
 <td align="center"><strong>3 Mile Race Times</strong></td></tr>
 <tr><td align="center">
 <img src="what-do-I-mention-here" width="480" height="300"
align="middle" />
 </td></tr></table>
 %STR(%'))];
column Date Mile_1 Mile_2 Mile_3 Mile_4;
define Date / display;
define Mile_1 / display;
define Mile_2 / display;
define Mile_3 / display;
define Mile_4 / display;
run;
quit;

 

Anybody who could help please?

 

Regards,

Arpit

7 REPLIES 7
Oligolas
Barite | Level 11

Hi Arpit,

 

did you already try this?

________________________

- Cheers -

Arpit_Agarwal
Fluorite | Level 6

Ok, so preimage works fine,

 

proc report data = running STYLE=[PREIMAGE="&_SASWS_/charts/bar16.png"];
column <varlist>;
......
run;
quit;

 

but that's not what I am looking for(thank you for suggesting though, I didn't know).

 

Reason - I am interested to hit the source of image (.png in this case sitting at the home directory of SAS Studio Online account) and embed it in HTML under PROC REPORT so that when I send the output to any mobile device (irrespective of iPhone or adroid or screen size) the solution doesn't look messy, depending on platform we're sending output to.

 

Does this give a clear picture of the problem statement?

Reference link : http://support.sas.com/resources/papers/proceedings12/240-2012.pdf

ballardw
Super User

You would want to replace

"&_SASWS_/charts"];

with

"&_SASWS_./charts"];

 

The Period after the _ denotes the end of the macro variable. Otherwise the macro processor looks for a macro variable named _SASWS_/CHARTS and will complain as the / is not valid in a macro variable name.

 

Since I don't know what &_SASWS_ might look like I'm not sure what modifications may be needed to get to be a valid src=argument.

 

 

Tom
Super User Tom
Super User

??

There is no need to insert a period.  Macro variable names cannot contain /. 

ballardw
Super User

In addition to @Oligolas's suggestion you may want to test the results of PREIMAGE in lieu of POSTIMAGE. You can get different appearance depending on order of insertion.

Cynthia_sas
SAS Super FREQ
And another suggestion is to carefully consider your destination of choice. ODS HTML does NOT embed the image you reference in the file. ODS HTML only makes an <IMG> tag that points to the location of the image. So you would need to send your HTML file and the image file in the email.

On the other hand, if you emailed PDF (or RTF), but for mobile, PDF is better, then the image WOULD be embedded in the PDF file and all you would need to do is send the PDF file.

cynthia
Tom
Super User Tom
Super User

If you really want to embed your PNG file into the HTML data you are generating then you will need actually embed the content of the PNG file and NOT just code a link to a separate file.

 

http://www.techerator.com/2011/12/how-to-embed-images-directly-into-your-html/

 

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 7 replies
  • 1793 views
  • 0 likes
  • 5 in conversation