Help using Base SAS procedures

Trouble using ods layout when organizing bookmarks in a pdf

Reply
Occasional Contributor
Posts: 15

Trouble using ods layout when organizing bookmarks in a pdf

Hi!

I have some problems when I'm organizing bookmarks in a pdf that are generating with help of proc report, ods layout and ods region.

To be able to “merge” two datasets into one pdf page I’m using ods layout, ods region and proc report..

This works fine until I’m starting to organize and deleting bookmarks using ods document and proc document. Because then the two datasets that were on the same pdf page has now been separated and now the datasets has one page each.

Does anyone know how I can manage to make ods layout and region work when I’m using proc document and ods document?

Here's my code;

ods document name=add(write);

option missing='' nonumber nodate topmargin=0.5in leftmargin=0.5in rightmargin=0.2in papersize=(29.7cm 21.0cm) NOQUOTELENMAX;

ods listing close;

ODS HTML close;

Ods proclabel="Innehållsförteckning" ;

data pdf1; set b8;

if befkod=10101;

run;

ods layout start;

ods region width=29.7cm height=6cm y=0.1in x=0.02in;

ods escapechar="^";

Ods proclabel="Grupp" ;

proc report data=pdf1 nowd completerows contents="Kod" nocenter

    style(report)=[frame=above rules=groups cellspacing=1 font_size=1]

    style(column)=[cellspacing=1 font_face=arial cellheight=28]

    style(header)=[frame=hsides backgroundcolor=#99CCFF borderbottomcolor=black font_face=arial just=c];

columns befkod r ("Marknadsdata***" m_antal m25 m50 m75)  ("&name" f_antal f25 f50 f75 diff) dummy;

define r / "Variabel" f=r. order=data group left style(column)={BORDERRIGHTCOLOR=gray borderbottomcolor=white BORDERLEFTCOLOR=white bordertopcolor=white};

define m_antal / 'Antal' f=tusen6.0 style(column)={cellwidth=100};

define m25 / '1:a kvartil' f=tusen9.0 style(column)={cellwidth=140};

define m50 / 'Median' f=tusen9.0 style(column)={cellwidth=140};

define m75 / '3:e kvartil' f=tusen9.0 style(column)={cellwidth=140 BORDERRIGHTCOLOR=gray borderbottomcolor=white BORDERLEFTCOLOR=white bordertopcolor=white};

define f_antal / 'Antal' f=tusen6.0 style(column)={cellwidth=100};

define f25 / '1:a kvartil' f=tusen9.0 style(column)={cellwidth=140};

define f50 / 'Median' f=tusen9.0 style(column)={cellwidth=140};

define f75 / '3:e kvartil' f=tusen9.0 style(column)={cellwidth=140};

define diff / '% av marknads-/median' f=percent. style(column)={cellwidth=200};

define dummy / noprint;

define befkod / noprint group;

break before befkod / page contents='';

compute dummy;

    if r=1 then call define (_row_, "style", 'style={cellspacing=1 frame=below bordertopcolor=black}');

    if r=5 then call define (_row_, "style", 'style={cellspacing=1 frame=below borderbottomcolor=black}');

endcomp;

run;

**************************** table two **********************;

data pdf2; set t4;

if befkod=10101;

run;

data pdf2; merge g pdf2;

by g;

holder=1;

run;

ods region width=29.7cm height=10.5cm y=6cm x=0.02in;

ods escapechar="^";

ods pdf pdftoc=1;

proc report data=pdf2 nowd completerows contents="" nocenter

    style(report)=[frame=above rules=groups cellspacing=1 font_size=1]

    style(column)=[cellspacing=1 font_face=arial cellheight=28]

    style(header)=[frame=hsides backgroundcolor=#99CCFF borderbottomcolor=black font_face=arial just=c];

columns holder g ("Berättigad till" shiftob overtid bil sti) maxbonus semester kon personalansvar alder dummy;

define g / "Gruppvariabel" f=g. order=data group left;

define shiftob / 'Skift OB' f=percent. style(column)={cellwidth=80} center;

define overtid / 'Övertids-/ersättning' f=percent. style(column)={cellwidth=140} center;

define bil / 'Bil' f=percent. style(column)={cellwidth=80} center;

define sti / 'STI' f=percent. style(column)={cellwidth=80} center;

define maxbonus / 'Maxbonus/(median)' f=percent. style(column)={cellwidth=140} center;

define semester / 'Semesterdagar/(median)' f=tusen9.0 style(column)={cellwidth=190} center;

define kon / 'Andel/kvinnor' f=percent. style(column)={cellwidth=110} center;

define personalansvar / 'Personal-/ansvar' f=percent. style(column)={cellwidth=140} center;

define alder / "Ålder/(median)" f=tusen9.0 style(column)={cellwidth=120} center;

define dummy / noprint;

define holder / noprint group;

break before holder / page contents='';

compute dummy;

    if g=1 then call define (_row_, "style", 'style={cellspacing=1 frame=below borderbottomcolor=gray}');

    if g=2 then call define (_row_, "style", 'style={cellspacing=1 frame=below borderbottomcolor=black}');

endcomp;

run;

ods layout end;

title;

footnote;

ods document close;

proc document name=Add;

list/levels=all;

run;

quit;

proc document name=Add;

list;

run;

quit;

proc document name=add ;

move Report#2\Report#1 to report#1;

delete Report#2;

run;

ods pdf file="G:\test.pdf";

replay;

run;

ods pdf close;

quit;

Ask a Question
Discussion stats
  • 0 replies
  • 164 views
  • 0 likes
  • 1 in conversation