Programming the statistical procedures from SAS

Re: SG and graphics as GRSEG catalog entry

Reply
Contributor
Posts: 28

Re: SG and graphics as GRSEG catalog entry

I should have specified my question precisely. Can I write out a Catalogue Entry (GRSEG) with a SG procedure?

Super User
Super User
Posts: 7,565

Re: SG and graphics as GRSEG catalog entry

Hi,

Thankfully I only had minimal contact with pre-template graphs.  There is a big difference in what is generated.  Behind the scens of an sgplot call is the definition of a Template.  This is in the form of a graph template.  Data is then fed into the template.  You can write these yourself and store them in catalogs if needed:

proc template;

  define statgraph <title>;

    begingraph;

...

    endgraph;

  end;

run;

You can get the template code from the sgplot by using the tmplout="..." option to store the text to a file. 

As a side note, please use consistent casing and indentation in code, makes it so much easier to read (and also I am not sure your code would run without proper spacing):

proc sgplot data=sashelp.class;

     scatter x=height y=weight;

run;

SAS Super FREQ
Posts: 3,547

Re: SG and graphics as GRSEG catalog entry

I don't think so. The SG procedures use ODS graphics. You can save the output to a bunch of destinations such as PNG, PDF, RTF, etc, but I don't think you can create an old-style graphics catalog entry.

Contributor
Posts: 28

Re: SG and graphics as GRSEG catalog entry

I assume that is the case.

I learned however, that it's possible to create an old-style catalog entry out of a PNG-figure with the GSLIDE procedure and IBACK= and GOUT= option.

GOPTIONS IBACK="path\graph.png" IMAGESTYLE=FIT;

PROC GSLIDE GOUT = <catalog entry name>;

QUIT;RUN;

Super User
Super User
Posts: 7,565

Re: SG and graphics as GRSEG catalog entry

May I ask, why do you need this "catalog" entry?  Personally I would avoid anything "catalog" orientated as historical.  You can have the template as a plain text file, your code as a plain text file, and your data as a dataset (or plain csv if you want to go completely non-prop).  No hidden things, no trying to track down catlogs, or working out how to get information out of them etc.

Contributor
Posts: 28

Re: SG and graphics as GRSEG catalog entry

Good question. It's currently the default setting for the figure output in our reporting system.

Super User
Posts: 10,867

Re: SG and graphics as GRSEG catalog entry

Unless you are creating the graphics for specific output to a specialized printer, code like Target= and interesting GDEVICE settings, it may be time to talk to the users of the output. There are enough additional features available in the SG procedures as well as having output to RTF, PDF and other easier to read and manipulate formats that it could be worth changing over completely.

Ask a Question
Discussion stats
  • 6 replies
  • 399 views
  • 0 likes
  • 4 in conversation