I try to flash a picture every 5 seconds. The pic info is from readin of a txt file.
However the process does not allow picture output flashed until kill the process(all the pictures dumped-out).
How to flash the picture periodically?!
%macro loopit(dt);
%do i=1 %to 1000;
%indexin(&dt.);// read in txt file
%let varx=...;
title "var=&varx";
proc gplot data=indata; // plot it
plot (dlastprice )*ind/legend overlay;
plot2 (&varx.)*ind/legend overlay;
run;quit;
title "";
data _null_; // sleep 5 sec
call sleep(5,1);
run;
%end;
%mend;
%let dt=0718;
%loopit(&dt.);
You need to make the ODS statements which open and close the destination(s) part of the loop.
ods trace on;
title "var=&varx";
proc gplot data=indata; // plot it
plot (dlastprice )*ind/legend overlay;
plot2 (&varx.)*ind/legend overlay;
run;quit;
title "";
ods trace off;
I put "ods trace on/off" inside the loop, still the pic is not released/flashed until the process gets killed (all pics get dumped)
That's just an auxiliary statement helping in revealing the names of output elements of procedures. You need to insert the statements that open and close the destination.
I tried and still get lost on how. Could you give out an example, with ODS and Proc GPlot(or alike)?!
First of all, you need to replace GPLOT with SGPLOT. The newer SGPLOT is integrated with ODS, which GPLOT is not.
This is a simple example creating a graph in the RTF destination:
ods rtf file="~/graph.rtf";
proc sgplot data=sashelp.class;
vbar weight;
run;
ods rtf close;
The graph file is created. But the picture is not flash(all are dumped out until the process is killed).
As @andreas_lds has already indicated, I don't think this will work with SAS Enterprise Guide or SAS Studio When you submit a SAS program in these it runs the complete job before displaying results as you have found. Maybe you could create a complete set of graphs in SAS then export them to MS Powerpoint as one graph per slide then use Powerpoint's slideshow functionality.
If you are trying this in SAS Enterprise Guide or SAS Studio, it is very unlikely that you will able to solve the problem at all, because those environments aren't made for displaying fancy reports.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.