The SAS Output Delivery System and reporting techniques

Second level bookmarks pdf

Accepted Solution Solved
Reply
Contributor
Posts: 46
Accepted Solution

Second level bookmarks pdf

Hello, everybody!

I'm trying to do a pdf with bookmarks, and my question is:

Can I control the second level of the bookmarks ?

For example: I have two proc reports.

Proc report data=sashelp.class contents= “ Weight < 95” nowd;

Columns name age weight height;

Define name /display;

Define age/display;

Define weight/display;

Define height/ display;

Where weight <95;

Run;

Proc report data=sashelp.class contents= “ Weight >= 95” nowd;

Columns name age weight height;

Define name /display;

Define age/display;

Define weight/display;

Define height/ display;

Where weight >=95;

Run;

If you run these reports probaly the bookmark will be like this:

Fig1.png

I'd like to know if a Can do something like the picture below:

fig2.png

Thanks in advanced !!!
















Accepted Solutions
Solution
‎05-16-2012 07:59 PM
PROC Star
Posts: 1,561

Re: Second level bookmarks pdf

Actually I can paste plain text.

ods listing close;
ods document name=TOCtest(write);
proc report data=SASHELP.CLASS contents= " Weight < 95" nowd;
  where WEIGHT <95;
  columns NAME AGE WEIGHT HEIGHT;
  define NAME /display;
  define AGE/display;
  define WEIGHT/display;
  define HEIGHT/ display;
run;
ods noptitle ;
ods proclabel " ";
proc report data=SASHELP.CLASS contents= " Weight >= 95" nowd;
  where WEIGHT >=95;
  columns NAME AGE WEIGHT HEIGHT;
  define NAME /display;
  define AGE/display;
  define WEIGHT/display;
  define HEIGHT/ display;
run;
ods document close;

proc document name=TOCtest;

ods listing;
list / levels=all;  run;     
ods listing close;

ods pdf file="before.pdf" ;
replay; run;
ods pdf close;

setlabel \Report#1 "Class";
*setlabel \Report#1\Report#1\Report#1 "< 95";
*setlabel \Report#2\Report#1\Report#1 ">= 95";
move \Report#1\Report#1\Report#1 to \Report#1;
move \Report#2\Report#1\Report#1 to \Report#1;
delete \Report#1\Report#1;
delete \Report#2;

/*  I'd rather make a new tree, but it misbehaves
make \Class;
* move (where=(_TYPE_ = 'Table')  to \Class#1;
move \Report#1\Report#1\Report#1 to \Class#1;
move \Report#2\Report#1\Report#1 to \Class#1;
delete \Report#1;
delete \Report#2;   */

ods pdf file="after.pdf";
replay \Report#1; run;
ods pdf close;

dir \;
ods listing;
list / levels=all; run;     
ods listing close;

quit;

View solution in original post


All Replies
Super Contributor
Posts: 273

Re: Second level bookmarks pdf

Here is a solution

data a;

set sashelp.class; xc=1;run;

ods pdf file="d:\temp\twolevels.pdf" bookmarkgen=yes ;

ods proclabel "first knot global";

Proc report data=a contents= " Weight < 95" nowd;

Columns xc name age weight height;

define xc /group noprint;

break before xc / contents="" page;

Define name /display;

Define age/display;

Define weight/display;

Define height/ display;

Where weight <95;

Run;

ods noptitle ;

ods proclabel " ";

Proc report data=a contents=" Weight >= 95" nowd;

Columns xc name age weight height;

define xc /group noprint;

break before xc / contents="" page;

Define name /display;

Define age/display;

Define weight/display;

Define height/ display;

Where weight >=95;

Run;

ods pdf close;

the trick is to create a non visible xc  that could help us to eliminate the third level in the report

HTH

Andre

contents="" and not contents=" "

Contributor
Posts: 46

Re: Second level bookmarks pdf

Hi Andre,

my problem is the second level if you see the second picture.

Look:

Your code:

What I need ....

fig2.png

tk's in advanced !!

Super Contributor
Posts: 273

Re: Second level bookmarks pdf

Manually

as the third level you want is dependent of the empty second

or

go into this solution i never have test

http://support.sas.com/kb/16/215.html0

Andre

support.sas.com/resources/papers/proceedings11/252-2011.pdf

SAS Super FREQ
Posts: 8,743

Re: Second level bookmarks pdf

Hi:

In addition to Andre's comments, if you save your output objects in an ODS DOCUMENT store, you can use PROC DOCUMENT statements to restructure, rearrange and replay your saved output objects to a different structure, including restructing the TOC or bookmarks.

  I wrote a paper about this a few years ago

http://support.sas.com/resources/papers/sgf09/318-2009.pdf

That has some examples of the restructuring that you can do with ODS DOCUMENT.

cynthia

PROC Star
Posts: 1,561

Re: Second level bookmarks pdf


A lot of things that look like they should work don't, but then proc document is not my cup of tea (yet).

Here is the closest I could get.

17-05-2012 11-56-00 .png

I don't know why the stuff in green doesn't do what it is supposed to.

Crappy IE8 won't let me past text,sorry, so here is a screenshot.

17-05-2012 11-47-22 .png

Solution
‎05-16-2012 07:59 PM
PROC Star
Posts: 1,561

Re: Second level bookmarks pdf

Actually I can paste plain text.

ods listing close;
ods document name=TOCtest(write);
proc report data=SASHELP.CLASS contents= " Weight < 95" nowd;
  where WEIGHT <95;
  columns NAME AGE WEIGHT HEIGHT;
  define NAME /display;
  define AGE/display;
  define WEIGHT/display;
  define HEIGHT/ display;
run;
ods noptitle ;
ods proclabel " ";
proc report data=SASHELP.CLASS contents= " Weight >= 95" nowd;
  where WEIGHT >=95;
  columns NAME AGE WEIGHT HEIGHT;
  define NAME /display;
  define AGE/display;
  define WEIGHT/display;
  define HEIGHT/ display;
run;
ods document close;

proc document name=TOCtest;

ods listing;
list / levels=all;  run;     
ods listing close;

ods pdf file="before.pdf" ;
replay; run;
ods pdf close;

setlabel \Report#1 "Class";
*setlabel \Report#1\Report#1\Report#1 "< 95";
*setlabel \Report#2\Report#1\Report#1 ">= 95";
move \Report#1\Report#1\Report#1 to \Report#1;
move \Report#2\Report#1\Report#1 to \Report#1;
delete \Report#1\Report#1;
delete \Report#2;

/*  I'd rather make a new tree, but it misbehaves
make \Class;
* move (where=(_TYPE_ = 'Table')  to \Class#1;
move \Report#1\Report#1\Report#1 to \Class#1;
move \Report#2\Report#1\Report#1 to \Class#1;
delete \Report#1;
delete \Report#2;   */

ods pdf file="after.pdf";
replay \Report#1; run;
ods pdf close;

dir \;
ods listing;
list / levels=all; run;     
ods listing close;

quit;

PROC Star
Posts: 1,561

Re: Second level bookmarks pdf

You gave a "helpful reply" star to yourself Abud instead of Andre. It is odd that this is even possible.

Did you manage to get correct level 2 labels instead of "Table 1" ?

Contributor
Posts: 46

Re: Second level bookmarks pdf

Hi Chris !

Thanks for letting me know about the error. Sorry Andre.

The code it's working almost perfectly (the labels are correct "<95" and ">95").

Now I'm reading the document (about proc document) to understand...

If you have more tips about this subject, please send by e-mail, it's very important for me......

Tk's in advanced

PROC Star
Posts: 1,561

Re: Second level bookmarks pdf

How did you get the labels to work properly Abud?

Super Contributor
Posts: 273

Re: Second level bookmarks pdf

Abud

I have read more about document and

from my solution the program is becaming now

ods listing close;

ods noptitle;

data a;

set sashelp.class; xc=1;run;

ods document name=testTOC(write);

ods pdf file="d:\temp\twolevels.pdf" bookmarkgen=yes ;

ods proclabel "Class";

Proc report data=a contents= " Weight < 95" nowd;

Columns xc name age weight height;

define xc /order noprint;

break before xc / contents="" page;

Define name /display;

Define age/display;

Define weight/display;

Define height/ display;

Where weight <95;

Run;

ods proclabel " ";

Proc report data=a contents=" Weight >= 95" nowd;

Columns xc name age weight height;

define xc /order noprint;

break before xc / contents="" page;

Define name /display;

Define age/display;

Define weight/display;

Define height/ display;

Where weight >=95;

Run;

ods pdf close;

ods document close;

ods ptitle;

ods listing;

proc document name=testTOC;

list/ levels=all; run;quit;

ods listing close;

proc document name=newtestTOC(write);

make CLASS;

dir ^^;

dir CLASS;

dir;

copy \work.testTOC\Report#1\Report#1 to ^;

copy \work.testTOC\Report#2\Report#1 to ^;

run;

list/ levels=all; run;

quit;

proc document name=work.Newtesttoc;

ods pdf file="d:\temp\twolevelscorrect.pdf";

replay;

run;

ods pdf close;

quit;


with this results

I found it more easier to reconstruct a new document in place of moving and loosing node+labels!

I recall that colored code was copied to word and then recopied  from word to this screen.

Andre

PROC Star
Posts: 1,561

Re: Second level bookmarks pdf

Andre, we want

kk2.png

not

kk1.png

Super Contributor
Posts: 273

Re: Second level bookmarks pdf

Here is my final try and success

i agree about the fact that it is quite difficult with that mixed of non natural code

ods html close;

ods noptitle;

data a;

set sashelp.class; xc=1;run;

ods document name=testAW(write);

ods proclabel "Class";

Proc report data=a contents= "Weight < 95" nowd;

Columns xc name age weight height;

define xc /order noprint;

break before xc / contents="" page;

Define name /display;

Define age/display;

Define weight/display;

Define height/ display;

Where weight <95;

Run;

ods proclabel " ";

Proc report data=a contents="Weight >= 95" nowd;

Columns xc name age weight height;

define xc /order noprint;

break before xc / contents="" page;

Define name /display;

Define age/display;

Define weight/display;

Define height/ display;

Where weight >=95;

Run;

ods pdf close;

ods document close;

ods ptitle;

ods listing;

proc document name=testAW;

list/ levels=all; run;

quit;

*ok ok;

proc document name=testAW2(write);

make CLASS;

dir ^^;

dir CLASS;

make Tab1;

setlabel \Class#1\Tab1#1 "weight < 95";

copy \work.testAW\Report#1\Report#1\Report#1 to \Class#1\Tab1#1;

make Tab2;

setlabel \class#1\Tab2#1  "weight >95";

copy \work.testAW\Report#2\Report#1\Report#1 to \Class#1\Tab2#1;

run;

list/ levels=all; run;

quit;

proc document name=work.testAW2;

ods pdf file="d:\temp\twolevels.pdf";

replay;

run;

ods pdf close;

quit;


Friday i did not see that the third level was producing an item in the toc

now it is without.

  


Andre

Contributor
Posts: 46

Re: Second level bookmarks pdf

Hi everbody!

Chris/Andre sorry, I was sick and because of that, I couldn't answer, but now, I think the last post is correct.

In my opinion the best think is create a proc report and to change the layout with ptoc document.

What about you ?

Super Contributor
Posts: 273

Re: Second level bookmarks pdf

Yes but break before is necessary

otherwise some more items and thus levels are reappearing !!

Andre

☑ This topic is SOLVED.

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

Discussion stats
  • 16 replies
  • 1163 views
  • 6 likes
  • 4 in conversation