BookmarkSubscribeRSS Feed
Filipvdr
Pyrite | Level 9
data _null_;
rc = stpsrv_header('Content-type','image/jpeg');
rc = stpsrv_header('Content-disposition','attachment; filename=temp.jpeg');
run;

%global pictureNr;
*%let pictureNr = 3596;
libname VARS '/imec/other/osp/vars';
%let Link;
data varspics;
set Vars.W_status_vars;
where pictureNr = &pictureNr;
call symput("Link",PictureLink);
run;
%stpbegin;
%put &Link;
%stpend;

when i run it in my browser it says open or save temp.jpeg, but when i open or save it i don't see my image?
4 REPLIES 4
Cynthia_sas
SAS Super FREQ
Hi:
Have you looked in your SAS log??? The %PUT statement will only write to the SAS log. %STPBEGIN only captures what is written to an output destination, like ODS HTML, ODS PDF, ODS RTF, etc.

I'm not sure what you're trying to do, but I suspect that you will have to use another method to write your image from the storage location to the _webout stream.

I suspect you might have to write your image using DATA _NULL_ or by publishing the image to a package. You might want to work with Tech Support on this question.

cynthia
Filipvdr
Pyrite | Level 9
Hmm i feel i'm almost there:

Stored Process A calls B:
[pre]
data _null_;
file _webout ;
put "";
put "";
put ' IMG SRC="/SASStoredProcess/do?_program=/FAB/enhanced_lot_hist_safe_vars">';
put "";
run;

Stored Process B:

%let old=%sysfunc(stpsrv_header(Pragma, nocache));
goptions gsfname=_webout gsfmode=replace dev=png xpixels=500 ypixels=500;

/* create a simple pie chart*/
proc gchart data=sashelp.shoes;
pie3d product/sumvar=sales;
run;
quit;
[/pre]

the pie chart is being displayed.

What I want now is to display an image (in my database or on the web for example.)

Any hints?

Message was edited by: Filipvdr Message was edited by: Filipvdr
Filipvdr
Pyrite | Level 9
data _null_;
infile 'C:\_today\mike.csv' recfm=n sharebuffers;
file 'C:\_today\mike.csv' recfm=n;
input a $char1.;
retain open 0;
/* This statement toggles the open flag. */
if a='"' then open=not open;
if a='0A'x and open then put ' ';
run;


is this possible with a jpg???
Cynthia_sas
SAS Super FREQ
Hi:
The technique you show is generally one used when copying a file (and/or possibly changing the file with the code in the program). In your code, the file is being read ffrom and written to the same physical storage location. When you are dealing with the Platform and _WEBOUT, you do NOT have a physical storage location, you have a "pipeline" between the requesting client application and the server machine processing the stored process.

_WEBOUT, in the context of the Platform, works a bit differently from a simple HTTP stream. If your client is a browser or is able to read streaming output, then the Platform servers deal with your content in one way, an appropriate way for an HTTP stream (which is frequently why you need to control the content-type heders if your stream is not text/html). If your client is NOT a browser or capable of handling HTTP streams (such as PowerPoint, for example), then the Platform servers generally turn the SP results into SASReport XML.

For sites running SAS/IntrNet, it was always guaranteed that the _WEBOUT pipeline would handle HTTP streams. The receiving clients know what to do with content from an HTTP stream.

When your jpeg comes down the pipeline, what do you want your browser to do??? Will your stored process users know that they're going to get a picture with no wrapper text?? Do all the browsers have plug-ins to open/render the picture???

You might need to use your program to publish your image to a package. You might need to add some more HTML wrapper text to your stored process. The best resource for your question is Tech Support. You can send them all your code, they can query you about your applications and your Platform configuration and help you arrive at an answer.

cynthia

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
  • 4 replies
  • 1215 views
  • 0 likes
  • 2 in conversation