The SAS Output Delivery System and reporting techniques

ODS PDF Spacing between Columns

Reply
Contributor
Posts: 33

ODS PDF Spacing between Columns

Hi All,

How can i obtain spacing between 2 column options in ODS PDF

Version: SAS 9.1.3
Operating System : AIX
Super Contributor
Super Contributor
Posts: 3,174

Re: ODS PDF Spacing between Columns

Clarification request: "obtain" or "increase" spacing?

Also, suggest you share whatever code you are executing for a more useful response.

Scott Barry
SBBWorks, Inc.
Contributor
Posts: 33

Re: ODS PDF Spacing between Columns

Hi Scott,

ODS Method : ODS PDF
SAS Verion : SAS 9.1.3
Operating System : AIX

The code as requested:
==================

options nobyline nonumber linesize=100 pagesize=60 nocenter nodate;

ODS PATH work.templat(update) sasuser.templat(read)
sashelp.tmplmst(read);

proc template;
define style border;
parent=Styles.Printer;
replace table from table /
borderwidth=0.0
;
replace header from header /
background=grayff;
end;
run;

/* Calculate the sysdate value in the format requireda and store */
/* it in the macro variable to be used in the TITLE statement */
data _null_;
call symput('_sysdate',put(input("&sysdate.",date7.),ddmmyyp10.));
run;

ODS _ALL_ CLOSE;
*FILENAME EGPDF 'test.pdf';
*ODS PDF(ID=EGPDF)
FILE=EGPDF
NOTOC
STYLE=border ;
ods pdf file="RD033.pdf" notoc style = border;

;
ods escapechar ='~';

title1
justify = c font=Helvetica height=9pt bold '#ByVal1' ;

title2
justify = l font=arial height=8pt '#ByVal2 '
justify = r font=arial height=8pt "Utskriftsdato: &_sysdate. kl &systime. side ~{thispage} av ~{lastpage} ";
title3;
title4
justify = l font=arial height=8pt '#ByVal3' justify = c font = arial height = 8pt "Postnummer fra: &from_cd.";
title5
justify = c font=arial height=8pt "Postnummer til:&to_cd." ;

title6 '_____________________________________________________________________________________';



footnote1 ;
footnote2;
footnote3;
footnote4;
footnote5;
footnote6;
footnote7;


proc report data = VL0608_104R_ADDRESS_DISTR_LST1 nowd spacing = 50 wrap ls=100
style(summary)={htmlstyle="border-top:solid;border-bottom:solid"} split='*';
* BY Report_name Report_ID Org_unit_Nm Org_unit_id;
BY Report_Name Report_Id Title_Line2;* Postal_Code_Cd Sort_Variable Address_List;

columns
Report_Name
Report_Id
Postal_Code_Cd
Sort_Variable

Address_list
Organization_id
Organization_Nm
Rack_Id
Sort_Variable
_Postal_Code_Cd;


define Report_ID/group noprint;
define Report_name/group noprint;
define Sort_Variable/order noprint;
define Postal_Code_Cd/noprint;
define Location_set_type_cd/group noprint;


define Address_list/left flow "GATE/VEI/STED" spacing=20
style(column)=[cellwidth=380pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;

define Organization_Nm/left flow " "
style(column)=[cellwidth=10pt font=(Arial, 6pt) just = left] flow
style(header)= [cellwidth=10pt font_weight=bold font=(Arial, 6pt) just = left] flow;

define Organization_id/left flow 'ENHET' spacing = 10
style(column)=[cellwidth=50pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;

define Rack_Id/left 'REOLNR' spacing = 10
style(column)=[cellwidth=50pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;

define _Postal_code_cd/left 'POSTNR' spacing = 10
style(column)=[cellwidth=50pt font=(Arial, 6pt) just = left] flow
style(header)= [font_weight=bold font=(Arial, 6pt) just = left] flow;
break after Sort_Variable/skip ol suppress;

compute after Sort_Variable;
line ' ';
endcomp;
run;


ODS _all_ close;
==================
SAS Super FREQ
Posts: 8,745

Re: ODS PDF Spacing between Columns

Sorry:
I cross-posted with you. I'm not sure what you're trying to achieve with your PROC TEMPLATE and PROC REPORT code.

When you use the REPLACE statement in SAS 9.1.3, you must RESPECIFY all the style elements that you want to keep, as outlined here in the documentation:
http://support.sas.com/rnd/base/early-access/odsdoc2/sashtml/tw5195/z1072349.htm
where it says:

If you use the REPLACE statement to create a style element in the new style definition, all style elements that inherit from that element inherit the definition that is in the new style definition. If you want to keep any attributes that are specified in the definition that is in the parent, you must respecify them in the definition that you create in the child style definition.


Usually, with a template such as yours, I would expect to see more style attributes specified for both TABLE and HEADER style elements. However, since you're using PROC REPORT and are using STYLE attributes in the REPORT syntax, I'm not sure why you're even using a custom TEMPLATE at all.

In your PROC REPORT code, you have some options, like SPACING= and FLOW and LS and WRAP .... which will NOT be used by ODS PDF at all. These are "LISTING" destination options -- meant to be used in a destination, such as the LISTING window or OUTPUT window, where every character represents 1 print position in a monospace font. Since ODS works with proportional fonts, options such as this LISTING-only options just do not work. In addition, you show the use of HTMLSTYLE, which you showed in a previous forum posting as well -- this technique will NOT work with ODS PDF. I would suggest that you do the following as a test:
1) Get rid of the HTMLSTYLE references in your PROC REPORT step, as they will only apply to ODS HTML output...not ODS PDF output
2) get rid of the template step completely
3) move your border width controls (it looks to me like you want to get rid of the border entirely??? and your header controls into the PROC REPORT statement:
[pre]
proc report data = VL0608_104R_ADDRESS_DISTR_LST1 nowd split='*'
style(header)={background=white}
style(report)={rules=none frame=void cellspacing=0 borderwidth=0}
style(summary)={background=graycc} split='*';

[/pre]

You can investigate the various interactions and possibilities of using RULES and FRAME and CELLSPACING by reading the ODS DOCUMENTATION under the topic: "Style Attributes and Their Values". (I changed "grayff" to "white", since that is the color represented by "grayff").

4) You cannot simulate an OVERLINE using HTMLSTYLE with ODS PDF, as previously explained. As an alternative, I have highlighted your summary line with a background color of graycc. You could choose an alternate type of highlighting, such as:
[pre]
style(summary)={font_weight=bold font_style=italic font_size=14pt}
[/pre]

Because the spacing = 50, spacing = 20 and spacing=10 will not work for ODS PDF, I would suggest you use cellwidth to increase the width of individual columns. Text will flow appropriately when you use ODS PDF, RTF and HTML, you do not need the FLOW option, as shown in the example below. Remember that with ODS PDF, you can also use the following SAS system options, in an OPTIONS statement to impact ODS PDF output:
[pre]
options orientation=landscape topmargin=".5in" bottommargin=".5in"
leftmargin=".5in" rightmargin=".5in";

[/pre]

cynthia

*** Example of automatic FLOW of text;

[pre]
options nodate nonumber center orientation=portrait
leftmargin=".5in" rightmargin=".5in"
topmargin=".5in" bottommargin=".5in";

%let long = Twas brillig and the slithy toves did gyre and gimble in the wabe.;
%let long2 = All mimsy were the borogroves and the momeraths outgrabe.;

** make some "big variables" in a copy of SASHELP.CLASS;
data makebig;
length bigvar bigvar2 bigvar3 $250 ;
set sashelp.class;

bigvar = catx(' ', name,"&long","&long2");

bigvar2 = bigvar;
bigvar3 = bigvar;
run;

ods pdf file='c:\temp\flow_cellwidth.pdf' ;

proc report data=makebig(obs=2) nowd split='*'
style(header)={background=white}
style(summary)={font_weight=bold font_style=italic background=graycc};
title '1a) Control Flow with CELLWIDTH';

column name age height weight bigvar bigvar2 bigvar3;
define bigvar / "CW=2in"
style(column)={just=l font_size=10pt font_face='Helvetica'
cellwidth=2.0in};

define bigvar2 / "CW=1in"
style(column)={just=l font_size=10pt font_face='Helvetica'
cellwidth=1.0in};

define bigvar3 / "CW=1.5in"
style(column)={just=l font_size=10pt font_face='Helvetica'
cellwidth=1.5in};
rbreak after / summarize;
run;
ods _all_ close;

[/pre]
SAS Super FREQ
Posts: 8,745

Re: ODS PDF Spacing between Columns

Hi:
Not sure what you mean by "obtain" or what you mean by "column options". The method that you use to increase a single column width with ODS PDF involves the use of the CELLWIDTH style attribute in SAS 9.1.3 (or the WIDTH style attribute in SAS 9.2). If you search the forum for previous postings, you should find some examples of using the CELLWIDTH style attribute.

If you want to show an "empty column" between 2 other columns, that is not something that would happen automatically with SAS. It would be easier to help if you provided the procedure code that you're using, and some idea of what your data is like, as well as your platform (AIX) and destination of choice (PDF) and version of SAS (9.1.3).

For informatioin about how to indent code and include code in forum postings, this is useful information:
http://support.sas.com/forums/thread.jspa?messageID=27609毙

cynthia
Contributor
Posts: 33

Re: ODS PDF Spacing between Columns

Hi Cynthia,

When i print the report, with the specified spacing using ODS PDF i am not able to see the spacing actually being applied. eg

VALUE1 VALUE2 .....

Even though i give a spacing of 10 it is still retains 1 spacing.

Regards
Russell
Ask a Question
Discussion stats
  • 5 replies
  • 685 views
  • 0 likes
  • 3 in conversation