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

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 !!!















1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

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

16 REPLIES 16
Andre
Obsidian | Level 7

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=" "

Abud
Calcite | Level 5

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 !!

Andre
Obsidian | Level 7

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

Cynthia_sas
SAS Super FREQ

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

ChrisNZ
Tourmaline | Level 20


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

ChrisNZ
Tourmaline | Level 20

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;

ChrisNZ
Tourmaline | Level 20

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" ?

Abud
Calcite | Level 5

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

ChrisNZ
Tourmaline | Level 20

How did you get the labels to work properly Abud?

Andre
Obsidian | Level 7

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

Andre
Obsidian | Level 7

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

Abud
Calcite | Level 5

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 ?

Andre
Obsidian | Level 7

Yes but break before is necessary

otherwise some more items and thus levels are reappearing !!

Andre

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
  • 16 replies
  • 4586 views
  • 8 likes
  • 4 in conversation