BookmarkSubscribeRSS Feed
JohnChen_TW
Quartz | Level 8

Hi Everyone,

 

I am using SAS 9.4 and attempting to generate all graphs, then present them collapsed under the Table of Contents.

Here is my program

ods graphics on;
ods _all_ close;
ods document name=WORK.CONTENTS(write);

data FigureTitle;
	length no number $ 60  title item $ 200;
	infile CARDS dlm=':';
    input no $  title $ number $ item $ @@;
	cards;
	01:Safety:Figure 1
	01:Safety:Figure 2
    01:Safety:Figure 3
	;
run;
data FigureTitle; set FigureTitle; pp=1; run;
proc report data=FigureTitle nowd  
        colwidth=8 spacing=2  
        center headskip split='|'
		contents="Table of Contents";
		columns pp no title number item;
	    define pp       / group noprint;
	    define no       / display noprint;
	    define title    / group left style=[cellwidth=40mm]  '' '' flow;
		define number   / display left style=[cellwidth=40mm]  'No.' '';
	    define item     / display left style=[cellwidth=160mm]  'Item' '' flow;
		break before pp /page contents='';
		title7 j=c h=9pt "Table of Contents";
run;
title7;
quit;

proc lifetest data=SurvivalData1 plots=survival method=KM;
	time T * Status(0);
	strata Group;
run;

proc lifetest data=SurvivalData2 plots=survival method=KM;
	time T * Status(0);
	strata Group;
run;

ods graphics off;
ods listing;

ods document close;
proc document name=WORK.CONTENTS;
list / details levels=all;
ods output Document.Properties=WORK.CONTENTS;
run;
quit;

Then, I have a list of document properties as below.

JohnChen_TW_0-1701164562370.png

 

Does anyone know how to move all documents with Type = Graph to the Report#1?

I've tried '^(where=(_type_='Graph')) to Report#1' but not work..

 

Furthermore, is there a way to adjust the Label in the document properties list based on the title defined in the TOC?

 

Thanks!

2 REPLIES 2
ballardw
Super User

Recommend showing the entire code you used where you attempted to select graphs with: '^(where=(_type_='Graph')) to Report#1' 

and the log.

By eye I would not expect that to work as the ^(where=) as I think the ^ in that position is likely to be treated as NOT. So would have selected everything except graphs.

 

"But not work" is awful vague.

Are there errors in the log?: Post the code and log in a code box opened with the "</>" to maintain formatting of error messages.

No output? Post any log in a code box.

Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "</>" icon or attached as text to show exactly what you have and that we can test code against.

Cynthia_sas
SAS Super FREQ
Hi: To add to @ballardw excellent response, my advice is to NOT try to MOVE within the existing document store. I prefer to keep a "good" original document store unchanged, as created by the procedures, and than start fresh in a new document store to build the structure I want and then copy the objects from the original document store to the restructured document store. Let me say that this is just my preference. However, it is the reason why I cannot offer any other advice because I just don't use MOVE.
However, having the original document store to fall back to when I mess up has been very useful.
My approach for a need to restructure would be to build my new document store, make the folder structure and then copy each item into the new folder structure. I do remember being able to replay using WHERE, but I do not recall being able to use the WHERE in a COPY (or MOVE) statement in PROC DOCUMENT. Did you check the documentation and paper examples for ODS DOCUMENT and PROC DOCUMENT??
Cynthia

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 724 views
  • 2 likes
  • 3 in conversation