BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
hulksmash
Obsidian | Level 7

Is it possible to create a graph in one program but print/reference it in another program for ODS output to excel.  I have about 5 different programs that do certain tasks and create various tables and graphs.  I want to then export all of those to an excel file at the end.  I figured out how to loop through all the work tables and print them but I cant seem to figure out how to reference a graph created in another program.  I am hoping it is just some option I am missing in the SGPLOT procedure.  I would like to avoid creating a persistent file (like a .png file) if possible and hoping I can just reference it in memory. 

 

The reason I want to do it this way is this is going to be a process that will expand over time.  More graphs/tables may be added and I don't want to have to repeat code multiple times when we add new processes

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Rhodochrosite | Level 12

The ODS DOCUMENT statement opens a document--a repository of information.  Leave it open as long as you like.  You can close it and reopen it if you like.  At the end, you close it.  The WRITE option starts a new document discarding any information that was there.  Without that option, new output is appended to the document.

 

Then, yes, use PROC DOCUMENT to display any subset of the results. You can even reorder the results.  You can change the results.  There is A LOT that you can do with PROC DOCUMENT.

 

You will typically need to run PROC DOCUMENT to list the contents of the document so that you know what paths to specify.

View solution in original post

3 REPLIES 3
WarrenKuhfeld
Rhodochrosite | Level 12

Yes.  Store the results in the ODS document.  This example works just within a step, but the documentation shows you how to save the document. http://go.documentation.sas.com/?docsetId=odsug&docsetTarget=n0nz6m09jrb7jsn1h8rngbvzk65u.htm&docset...

 

ods document name=MyDoc (write);
proc reg data=sashelp.class;
   model weight=height;
quit;
ods document close;

proc document name=MyDoc;
   list / levels=all;
quit;

proc document name=MyDoc;
   replay \Reg#1\MODEL1#1\ObswiseStats#1\Weight#1\FitPlot#1;
quit;
hulksmash
Obsidian | Level 7

Looks like this may be what I am looking for.  To be clear I will need to run the "ods document name=mydoc;" before each program correct and than use the "proc document" at the end to list and ODS to excel?

WarrenKuhfeld
Rhodochrosite | Level 12

The ODS DOCUMENT statement opens a document--a repository of information.  Leave it open as long as you like.  You can close it and reopen it if you like.  At the end, you close it.  The WRITE option starts a new document discarding any information that was there.  Without that option, new output is appended to the document.

 

Then, yes, use PROC DOCUMENT to display any subset of the results. You can even reorder the results.  You can change the results.  There is A LOT that you can do with PROC DOCUMENT.

 

You will typically need to run PROC DOCUMENT to list the contents of the document so that you know what paths to specify.

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
  • 3 replies
  • 786 views
  • 1 like
  • 2 in conversation