|
HOW CAN I AUTOMATICALLY UPDATAE A PERMANENT CATALOG WITH A NEW GRAPH WHEN I CREATE THE GRAPH? INPUT: I am developing a series of graphs to illustrate my company's annual report. I want to be able to review the graphs at any time, so I store them in a permanent catalog. The catalog, REPRTCAT, is in a library I refer to with the libref LIB94. The problem I have is that every time I revise one of the graphs, I have to go through several steps to move the new version from the temporary catalog WORK.GSEG to my permanent catalog, LIB94.REPRTCAT. For example, I used the GSLIDE procedure to create the title slides and stored them in the permanent catalog as TITLE1, TITLE2, and so forth. When I revise a slide by rerunning the GSLIDE program, SAS/GRAPH automatically stores the new version in WORK.GSEG as GSLIDE, or GSLIDE and some number like GSLIDE3 if I have run the program more than once. When I have the slide the way I want it, I have to rename the temporary catalog entry in WORK.GSEG and then copy the entry to the permanent catalog LIB94.REPRTCAT. This is how I do it:
How can I eliminate some of these steps and automatically update the permanent catalog with the new graph when I create it? OUTPUT: You can simplify this process by working directly in the permanent catalog and bypassing the temporary catalog, WORK.GSEG. This method requires only two short steps that can be added to each program that generates a graph:
/* Invoke GREPLAY in line mode (NOFS option). */
/* Specify the permanent catalog (IGOUT= option). */
proc greplay nofs igout=lib94.reprtcat;
/* Delete the existing entry, TITLE2. */
delete title2;
run;
quit;
For example, to automate replacement of two plots called COSTSQ1 and COSTSQ2, your program might look like this:
/* Delete existing entries from the permanent catalog */
proc greplay nofs igout=lib94.reprtcat;
delete costsq1 costsq2;
run;
quit;
/* Create the plots and specify the permanent catalog. */
proc gplot data=datalib.curexp gout=lib94.reprtcat;
/* Define the title for the first plot. */
title1 font=swiss height=4 'Total Expenses: First Quarter';
/* Create and name the first plot. */
plot exp*q1 / name='costsq1';
run;
/* Define the title for the second plot. */
title1 font=swiss height=4 'Total Expenses: Second Quarter';
/* Create and name the second plot. */
plot exp*q2 / name='costsq2';
run;
quit;
Note: If you are working with templated graphs, you must delete the template entry as well as the graphs that are included in the template. |