The SAS Output Delivery System and reporting techniques

How to get metadata about document charts after they have been created?

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

How to get metadata about document charts after they have been created?

Hello,

 

I have a user code producing some ODS charts and I would like to extract some meta-information about them back into SAS. What I would like to know is the titles and keys/values (if using BY statement on charting procedure) of relevant charts, because I would like to build a custom navigation around the charts.

 

I tried to set the ODS destination to document for the user code, and then use PROC DOCUMENT, LIST command to query the document after it was created. I was able to extract the document information (including the keys/values) to the LISTING destination, but I don’t know how and if it is possible to get it back as a SAS dataset, so I could match the charts produced. It seems that LIST statement of PROC DOCUMENT produces a table in the output, but I am stumped as to how to get this table back into SAS.

 

Also, this method doesn’t give me the titles for the charts, I am not sure if there is a way to get this information too by querying the document, but it’s a lesser problem.

 

Here’s some code to illustrate what I was trying to do:

 

DATA WORK;
INPUT X Y P Q;
DATALINES;
1 1 0 0
2 4 0 0
3 9 0 1
4 16 0 1
5 25 1 0
6 36 1 0
7 49 1 1
8 64 1 1
;

PROC PRINT DATA=WORK;

ODS LISTING CLOSE;
ODS DOCUMENT NAME=DOC1;

TITLE "A fishy graph";
PROC SGPLOT DATA=WORK;
BY P Q;
SERIES X=X Y=Y;
RUN;

TITLE "A weird graph";
PROC SGPLOT DATA=WORK;
BY P;
SERIES X=X Y=Y;
RUN;

TITLE;
ODS DOCUMENT CLOSE;
ODS LISTING gpath="/some_path" (url=none);

ODS DOCUMENT NAME=DOC2;
PROC DOCUMENT NAME=DOC1;
LIST /DETAILS BYGROUPS LEVELS=ALL;
QUIT;
ODS DOCUMENT CLOSE;

ODS LISTING CLOSE;
ODS OUTPUT Properties#2(persist=proc)=KEYS;
PROC DOCUMENT NAME=DOC2;
LIST /DETAILS LEVELS=ALL;
QUIT;
ODS OUTPUT CLOSE;
ODS LISTING;

PROC PRINT DATA=KEYS;

 

The final PROC PRINT fails because the WORK.KEYS dataset is not there.. I am not sure what exactly should go to the ODS OUTPUT statement to get the output, but I know if I try the other PROC DOCUMENT that the output of first PROC DOCUMENT is two tables, one for each chart. Or maybe there is an easier approach.

 

Thank you in advance for any help.

(Btw, if that’s of any relevance, I am using SAS Base on mainframe.)


Accepted Solutions
Solution
‎10-15-2015 06:01 AM
Respected Advisor
Posts: 4,659

Re: How to get metadata about document charts after they have been created?

Try:

 

PROC DOCUMENT NAME=DOC1;
LIST /DETAILS BYGROUPS LEVELS=ALL;
ods output Properties=prop;
QUIT;

and check dataset prop.

PG

View solution in original post


All Replies
Solution
‎10-15-2015 06:01 AM
Respected Advisor
Posts: 4,659

Re: How to get metadata about document charts after they have been created?

Try:

 

PROC DOCUMENT NAME=DOC1;
LIST /DETAILS BYGROUPS LEVELS=ALL;
ods output Properties=prop;
QUIT;

and check dataset prop.

PG
New Contributor
Posts: 2

Re: How to get metadata about document charts after they have been created?

Thank you, that's exactly what I needed!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 330 views
  • 0 likes
  • 2 in conversation