The SAS Output Delivery System and reporting techniques

ODS PDF Output in 2 pages using Proc Report

Reply
Occasional Contributor
Posts: 7

ODS PDF Output in 2 pages using Proc Report


Hello All

I have a dataset which contains 120 observations and 6 columns as specified below (I have only listed 6 observations). This needs to be exported into a pdf document into two pages. When I used ods pdf along with proc report, it came in 5 pages. I need it in two pages. Can you please help me? Should I keep changing font size, margin settings etc or is there any other way to achieve it.

FCC Name            Payment   ID   Section  Ratio 

33  Los Vegas, NV   $1672.85  AI1  K087     33.6%

23  Columbus, OH    $2345.70  BI3  S171     31.6%

19  Rochester, NY   $8124.30  AI7  D171     30.7%

20  Dayton, OH      $6259.00  AI4  Y345     28.2%

60  San Jose, CA    $5150.30  vI7  D871     25.1%

70  Dallas, TX      $9250.00  KI4  X355     23.2%

Thanks

Super User
Posts: 3,233

Re: ODS PDF Output in 2 pages using Proc Report

120 lines in two pages is a lot. Make sure your report is using PORTRAIT orientation. Reduce top and bottom margins to a minimum.

Try this: 24217 - How can I shrink or grow my ODS PDF output?

I'd recommend switching to proportional fonts that take up less space like Arial or Arial Narrow rather than fixed fonts like Courier.

At the end of the day 120 lines in two pages may not be very readable.

Occasional Contributor
Posts: 6

Re: ODS PDF Output in 2 pages using Proc Report

You can achieve it by following way;


DATA bdata;

INPUT FCC Name $ 5-17 Payment $ ID $ Section $ Ratio $;

obsid=_N_;

DATALINES;

1   Los Vegas, NV   $1672.85  AI1  K087     33.6%

2   Columbus, OH    $2345.70  BI3  S171     31.6%

3   Rochester, NY   $8124.30  AI7  D171     30.7%

4   Dayton, OH      $6259.00  AI4  Y345     28.2%

5   San Jose, CA    $5150.30  vI7  D871     25.1%

6   Dallas, TX      $9250.00  KI4  X355     23.2%

7   Los Vegas, NV   $1672.85  AI1  K087     33.6%

8   Columbus, OH    $2345.70  BI3  S171     31.6%

9   Rochester, NY   $8124.30  AI7  D171     30.7%

10  Dayton, OH      $6259.00  AI4  Y345     28.2%

11  San Jose, CA    $5150.30  vI7  D871     25.1%

12  Dallas, TX      $9250.00  KI4  X355     23.2%

13  Los Vegas, NV   $1672.85  AI1  K087     33.6%

14  Columbus, OH    $2345.70  BI3  S171     31.6%

15  Rochester, NY   $8124.30  AI7  D171     30.7%

16  Dayton, OH      $6259.00  AI4  Y345     28.2%

17  San Jose, CA    $5150.30  vI7  D871     25.1%

18  Dallas, TX      $9250.00  KI4  X355     23.2%

19  Los Vegas, NV   $1672.85  AI1  K087     33.6%

20  Columbus, OH    $2345.70  BI3  S171     31.6%

21  Rochester, NY   $8124.30  AI7  D171     30.7%

22  Dayton, OH      $6259.00  AI4  Y345     28.2%

23  San Jose, CA    $5150.30  vI7  D871     25.1%

24  Dallas, TX      $9250.00  KI4  X355     23.2%

25  Los Vegas, NV   $1672.85  AI1  K087     33.6%

26  Columbus, OH    $2345.70  BI3  S171     31.6%

27  Rochester, NY   $8124.30  AI7  D171     30.7%

28  Dayton, OH      $6259.00  AI4  Y345     28.2%

29  San Jose, CA    $5150.30  vI7  D871     25.1%

30  Dallas, TX      $9250.00  KI4  X355     23.2%

31  Los Vegas, NV   $1672.85  AI1  K087     33.6%

32  Columbus, OH    $2345.70  BI3  S171     31.6%

33  Rochester, NY   $8124.30  AI7  D171     30.7%

34  Dayton, OH      $6259.00  AI4  Y345     28.2%

35  San Jose, CA    $5150.30  vI7  D871     25.1%

36  Dallas, TX      $9250.00  KI4  X355     23.2%

37  Los Vegas, NV   $1672.85  AI1  K087     33.6%

38  Columbus, OH    $2345.70  BI3  S171     31.6%

39  Rochester, NY   $8124.30  AI7  D171     30.7%

40  Dayton, OH      $6259.00  AI4  Y345     28.2%

41  San Jose, CA    $5150.30  vI7  D871     25.1%

42  Dallas, TX      $9250.00  KI4  X355     23.2%

43  Los Vegas, NV   $1672.85  AI1  K087     33.6%

44  Columbus, OH    $2345.70  BI3  S171     31.6%

45  Rochester, NY   $8124.30  AI7  D171     30.7%

46  Dayton, OH      $6259.00  AI4  Y345     28.2%

47  San Jose, CA    $5150.30  vI7  D871     25.1%

48  Dallas, TX      $9250.00  KI4  X355     23.2%

49  Los Vegas, NV   $1672.85  AI1  K087     33.6%

50  Columbus, OH    $2345.70  BI3  S171     31.6%

51  Rochester, NY   $8124.30  AI7  D171     30.7%

52  Dayton, OH      $6259.00  AI4  Y345     28.2%

53  San Jose, CA    $5150.30  vI7  D871     25.1%

54  Dallas, TX      $9250.00  KI4  X355     23.2%

55  Los Vegas, NV   $1672.85  AI1  K087     33.6%

56  Columbus, OH    $2345.70  BI3  S171     31.6%

57  Rochester, NY   $8124.30  AI7  D171     30.7%

58  Dayton, OH      $6259.00  AI4  Y345     28.2%

59  San Jose, CA    $5150.30  vI7  D871     25.1%

60  Dallas, TX      $9250.00  KI4  X355     23.2%

61  Los Vegas, NV   $1672.85  AI1  K087     33.6%

62  Columbus, OH    $2345.70  BI3  S171     31.6%

63  Rochester, NY   $8124.30  AI7  D171     30.7%

64  Dayton, OH      $6259.00  AI4  Y345     28.2%

65  San Jose, CA    $5150.30  vI7  D871     25.1%

66  Dallas, TX      $9250.00  KI4  X355     23.2%

67  Los Vegas, NV   $1672.85  AI1  K087     33.6%

68  Columbus, OH    $2345.70  BI3  S171     31.6%

69  Rochester, NY   $8124.30  AI7  D171     30.7%

70  Dayton, OH      $6259.00  AI4  Y345     28.2%

71  San Jose, CA    $5150.30  vI7  D871     25.1%

72  Dallas, TX      $9250.00  KI4  X355     23.2%

73  Los Vegas, NV   $1672.85  AI1  K087     33.6%

74  Columbus, OH    $2345.70  BI3  S171     31.6%

75  Rochester, NY   $8124.30  AI7  D171     30.7%

76  Dayton, OH      $6259.00  AI4  Y345     28.2%

77  San Jose, CA    $5150.30  vI7  D871     25.1%

78  Dallas, TX      $9250.00  KI4  X355     23.2%

79  Los Vegas, NV   $1672.85  AI1  K087     33.6%

80  Columbus, OH    $2345.70  BI3  S171     31.6%

81  Rochester, NY   $8124.30  AI7  D171     30.7%

82  Dayton, OH      $6259.00  AI4  Y345     28.2%

83  San Jose, CA    $5150.30  vI7  D871     25.1%

84  Dallas, TX      $9250.00  KI4  X355     23.2%

85  Los Vegas, NV   $1672.85  AI1  K087     33.6%

86  Columbus, OH    $2345.70  BI3  S171     31.6%

87  Rochester, NY   $8124.30  AI7  D171     30.7%

88  Dayton, OH      $6259.00  AI4  Y345     28.2%

89  San Jose, CA    $5150.30  vI7  D871     25.1%

90  Dallas, TX      $9250.00  KI4  X355     23.2%

91  Los Vegas, NV   $1672.85  AI1  K087     33.6%

92  Columbus, OH    $2345.70  BI3  S171     31.6%

93  Rochester, NY   $8124.30  AI7  D171     30.7%

94  Dayton, OH      $6259.00  AI4  Y345     28.2%

95  San Jose, CA    $5150.30  vI7  D871     25.1%

96  Dallas, TX      $9250.00  KI4  X355     23.2%

97  Los Vegas, NV   $1672.85  AI1  K087     33.6%

98  Columbus, OH    $2345.70  BI3  S171     31.6%

99  Rochester, NY   $8124.30  AI7  D171     30.7%

100 Dayton, OH      $6259.00  AI4  Y345     28.2%

101 San Jose, CA    $5150.30  vI7  D871     25.1%

102 Dallas, TX      $9250.00  KI4  X355     23.2%

103 Los Vegas, NV   $1672.85  AI1  K087     33.6%

104 Columbus, OH    $2345.70  BI3  S171     31.6%

105 Rochester, NY   $8124.30  AI7  D171     30.7%

106 Dayton, OH      $6259.00  AI4  Y345     28.2%

107 San Jose, CA    $5150.30  vI7  D871     25.1%

108 Dallas, TX      $9250.00  KI4  X355     23.2%

109 Los Vegas, NV   $1672.85  AI1  K087     33.6%

110 Columbus, OH    $2345.70  BI3  S171     31.6%

111 Rochester, NY   $8124.30  AI7  D171     30.7%

112 Dayton, OH      $6259.00  AI4  Y345     28.2%

113 San Jose, CA    $5150.30  vI7  D871     25.1%

114 Dallas, TX      $9250.00  KI4  X355     23.2%

115 Los Vegas, NV   $1672.85  AI1  K087     33.6%

116 Columbus, OH    $2345.70  BI3  S171     31.6%

117 Rochester, NY   $8124.30  AI7  D171     30.7%

118 Dayton, OH      $6259.00  AI4  Y345     28.2%

119 San Jose, CA    $5150.30  vI7  D871     25.1%

120 Dallas, TX      $9250.00  KI4  X355     23.2%

;

RUN;

OPTIONS PAPERSIZE=A4 ORIENTATION=LANDSCAPE;

ODS PDF FILE='E:\fccdata.pdf';

ODS LAYOUT GRIDDED COLUMNS=3 COLUMN_GUTTER=0.13in STYLE={BACKGROUND=lightgray};

  ODS REGION  STYLE={BACKGROUND=lightblue}; 

  PROC REPORT DATA=bdata;

  COLUMNS(FCC Name Payment ID Section Ratio);

  WHERE obsid GT 0 AND obsid LE 40;

  RUN;

  ODS REGION STYLE={BACKGROUND=lightblue};  

  PROC REPORT DATA=bdata;

  COLUMNS(FCC Name Payment ID Section Ratio);

  WHERE obsid GT 40 AND obsid LE 80;

  RUN;

  ODS REGION STYLE={BACKGROUND=lightblue};  

  PROC REPORT DATA=bdata;

  COLUMNS(FCC Name Payment ID Section Ratio);

  WHERE obsid GT 80 AND obsid LE 120;

  RUN;

ODS LAYOUT END; 

ODS PDF CLOSE;

Occasional Contributor
Posts: 7

Re: ODS PDF Output in 2 pages using Proc Report

Hi Zahir

Thanks for your response. When I submitted the ods layout gridded, it gave me ERROR as followed:Can you please help me. Thanks.

12         ODS LAYOUT GRIDDED COLUMNS=3 COLUMN_GUTTER=0.13in STYLE={BACKGROUND=lightgray};
                      _______                                _____
                      22                                     202
                      202
ERROR 22-322: Syntax error, expecting one of the following: ;, =, END, RENDER, START.

ERROR 202-322: The option or parameter is not recognized and will be ignored.

12       ! ODS LAYOUT GRIDDED COLUMNS=3 COLUMN_GUTTER=0.13in STYLE={BACKGROUND=lightgray};
                                                             _____
                                                             22
ERROR 22-322: Syntax error, expecting one of the following: ;, COLUMNS, COLUMN_GUTTER, COLUMN_WIDTHS, ENTIREPAGE, HEIGHT, RO
WS,

Occasional Contributor
Posts: 6

Re: ODS PDF Output in 2 pages using Proc Report

I'm using SAS 9.4 1M2. If you don't have SAS 9.4 then it may arise error.

Super User
Posts: 9,856

Re: ODS PDF Output in 2 pages using Proc Report

Specify a special paper for your situation .

OPTIONS PAPERSIZE=(4in  40in)  ;


Occasional Contributor
Posts: 7

Re: ODS PDF Output in 2 pages using Proc Report

Hi Xia

Thanks for the response. When I used the papersize option, it actually gave two variables in one page and another 4 variables in the second page.I need all the 6 columns and 120 observations in 2 pages.

Thanks


Super User
Posts: 11,105

Re: ODS PDF Output in 2 pages using Proc Report

If you used 4in that's kind of narrow.

I would also try a style, or customize a style, to use smaller fontsizes than the default PDF. Possibly Meadow but definitely you'll need smaller top and bottom margins.

SAS Super FREQ
Posts: 8,814

Re: ODS PDF Output in 2 pages using Proc Report

Hi: I just used standard portrait and the COLUMNS=2 option to produce this:

two_col_pdf.png

from this code (using 120 rows from the program previously posted).

cynthia

options nodate nonumber orientation=portrait topmargin=.1in bottommargin=.1in

        leftmargin=.1in rightmargin=.1in;

        

ods pdf file='c:\temp\twocol.pdf' columns=2;

proc report data=bdata nowd

  style(header)={font_size=10pt}

  style(column)={font_size=9pt};

  column FCC Name  Payment   ID   Section  Ratio;

run;

ods pdf close;

Super User
Posts: 9,856

Re: ODS PDF Output in 2 pages using Proc Report

Try this one :

DATA bdata;
INPUT FCC Name $ 5-17 Payment $ ID $ Section $ Ratio $;
obsid=_N_;
DATALINES;
1   Los Vegas, NV   $1672.85  AI1  K087     33.6%
2   Columbus, OH    $2345.70  BI3  S171     31.6%
3   Rochester, NY   $8124.30  AI7  D171     30.7%
4   Dayton, OH      $6259.00  AI4  Y345     28.2%
5   San Jose, CA    $5150.30  vI7  D871     25.1%
6   Dallas, TX      $9250.00  KI4  X355     23.2%
7   Los Vegas, NV   $1672.85  AI1  K087     33.6%
8   Columbus, OH    $2345.70  BI3  S171     31.6%
9   Rochester, NY   $8124.30  AI7  D171     30.7%
10  Dayton, OH      $6259.00  AI4  Y345     28.2%
11  San Jose, CA    $5150.30  vI7  D871     25.1%
12  Dallas, TX      $9250.00  KI4  X355     23.2%
13  Los Vegas, NV   $1672.85  AI1  K087     33.6%
14  Columbus, OH    $2345.70  BI3  S171     31.6%
15  Rochester, NY   $8124.30  AI7  D171     30.7%
16  Dayton, OH      $6259.00  AI4  Y345     28.2%
17  San Jose, CA    $5150.30  vI7  D871     25.1%
18  Dallas, TX      $9250.00  KI4  X355     23.2%
19  Los Vegas, NV   $1672.85  AI1  K087     33.6%
20  Columbus, OH    $2345.70  BI3  S171     31.6%
21  Rochester, NY   $8124.30  AI7  D171     30.7%
22  Dayton, OH      $6259.00  AI4  Y345     28.2%
23  San Jose, CA    $5150.30  vI7  D871     25.1%
24  Dallas, TX      $9250.00  KI4  X355     23.2%
25  Los Vegas, NV   $1672.85  AI1  K087     33.6%
26  Columbus, OH    $2345.70  BI3  S171     31.6%
27  Rochester, NY   $8124.30  AI7  D171     30.7%
28  Dayton, OH      $6259.00  AI4  Y345     28.2%
29  San Jose, CA    $5150.30  vI7  D871     25.1%
30  Dallas, TX      $9250.00  KI4  X355     23.2%
31  Los Vegas, NV   $1672.85  AI1  K087     33.6%
32  Columbus, OH    $2345.70  BI3  S171     31.6%
33  Rochester, NY   $8124.30  AI7  D171     30.7%
34  Dayton, OH      $6259.00  AI4  Y345     28.2%
35  San Jose, CA    $5150.30  vI7  D871     25.1%
36  Dallas, TX      $9250.00  KI4  X355     23.2%
37  Los Vegas, NV   $1672.85  AI1  K087     33.6%
38  Columbus, OH    $2345.70  BI3  S171     31.6%
39  Rochester, NY   $8124.30  AI7  D171     30.7%
40  Dayton, OH      $6259.00  AI4  Y345     28.2%
41  San Jose, CA    $5150.30  vI7  D871     25.1%
42  Dallas, TX      $9250.00  KI4  X355     23.2%
43  Los Vegas, NV   $1672.85  AI1  K087     33.6%
44  Columbus, OH    $2345.70  BI3  S171     31.6%
45  Rochester, NY   $8124.30  AI7  D171     30.7%
46  Dayton, OH      $6259.00  AI4  Y345     28.2%
47  San Jose, CA    $5150.30  vI7  D871     25.1%
48  Dallas, TX      $9250.00  KI4  X355     23.2%
49  Los Vegas, NV   $1672.85  AI1  K087     33.6%
50  Columbus, OH    $2345.70  BI3  S171     31.6%
51  Rochester, NY   $8124.30  AI7  D171     30.7%
52  Dayton, OH      $6259.00  AI4  Y345     28.2%
53  San Jose, CA    $5150.30  vI7  D871     25.1%
54  Dallas, TX      $9250.00  KI4  X355     23.2%
55  Los Vegas, NV   $1672.85  AI1  K087     33.6%
56  Columbus, OH    $2345.70  BI3  S171     31.6%
57  Rochester, NY   $8124.30  AI7  D171     30.7%
58  Dayton, OH      $6259.00  AI4  Y345     28.2%
59  San Jose, CA    $5150.30  vI7  D871     25.1%
60  Dallas, TX      $9250.00  KI4  X355     23.2%
61  Los Vegas, NV   $1672.85  AI1  K087     33.6%
62  Columbus, OH    $2345.70  BI3  S171     31.6%
63  Rochester, NY   $8124.30  AI7  D171     30.7%
64  Dayton, OH      $6259.00  AI4  Y345     28.2%
65  San Jose, CA    $5150.30  vI7  D871     25.1%
66  Dallas, TX      $9250.00  KI4  X355     23.2%
67  Los Vegas, NV   $1672.85  AI1  K087     33.6%
68  Columbus, OH    $2345.70  BI3  S171     31.6%
69  Rochester, NY   $8124.30  AI7  D171     30.7%
70  Dayton, OH      $6259.00  AI4  Y345     28.2%
71  San Jose, CA    $5150.30  vI7  D871     25.1%
72  Dallas, TX      $9250.00  KI4  X355     23.2%
73  Los Vegas, NV   $1672.85  AI1  K087     33.6%
74  Columbus, OH    $2345.70  BI3  S171     31.6%
75  Rochester, NY   $8124.30  AI7  D171     30.7%
76  Dayton, OH      $6259.00  AI4  Y345     28.2%
77  San Jose, CA    $5150.30  vI7  D871     25.1%
78  Dallas, TX      $9250.00  KI4  X355     23.2%
79  Los Vegas, NV   $1672.85  AI1  K087     33.6%
80  Columbus, OH    $2345.70  BI3  S171     31.6%
81  Rochester, NY   $8124.30  AI7  D171     30.7%
82  Dayton, OH      $6259.00  AI4  Y345     28.2%
83  San Jose, CA    $5150.30  vI7  D871     25.1%
84  Dallas, TX      $9250.00  KI4  X355     23.2%
85  Los Vegas, NV   $1672.85  AI1  K087     33.6%
86  Columbus, OH    $2345.70  BI3  S171     31.6%
87  Rochester, NY   $8124.30  AI7  D171     30.7%
88  Dayton, OH      $6259.00  AI4  Y345     28.2%
89  San Jose, CA    $5150.30  vI7  D871     25.1%
90  Dallas, TX      $9250.00  KI4  X355     23.2%
91  Los Vegas, NV   $1672.85  AI1  K087     33.6%
92  Columbus, OH    $2345.70  BI3  S171     31.6%
93  Rochester, NY   $8124.30  AI7  D171     30.7%
94  Dayton, OH      $6259.00  AI4  Y345     28.2%
95  San Jose, CA    $5150.30  vI7  D871     25.1%
96  Dallas, TX      $9250.00  KI4  X355     23.2%
97  Los Vegas, NV   $1672.85  AI1  K087     33.6%
98  Columbus, OH    $2345.70  BI3  S171     31.6%
99  Rochester, NY   $8124.30  AI7  D171     30.7%
100 Dayton, OH      $6259.00  AI4  Y345     28.2%
101 San Jose, CA    $5150.30  vI7  D871     25.1%
102 Dallas, TX      $9250.00  KI4  X355     23.2%
103 Los Vegas, NV   $1672.85  AI1  K087     33.6%
104 Columbus, OH    $2345.70  BI3  S171     31.6%
105 Rochester, NY   $8124.30  AI7  D171     30.7%
106 Dayton, OH      $6259.00  AI4  Y345     28.2%
107 San Jose, CA    $5150.30  vI7  D871     25.1%
108 Dallas, TX      $9250.00  KI4  X355     23.2%
109 Los Vegas, NV   $1672.85  AI1  K087     33.6%
110 Columbus, OH    $2345.70  BI3  S171     31.6%
111 Rochester, NY   $8124.30  AI7  D171     30.7%
112 Dayton, OH      $6259.00  AI4  Y345     28.2%
113 San Jose, CA    $5150.30  vI7  D871     25.1%
114 Dallas, TX      $9250.00  KI4  X355     23.2%
115 Los Vegas, NV   $1672.85  AI1  K087     33.6%
116 Columbus, OH    $2345.70  BI3  S171     31.6%
117 Rochester, NY   $8124.30  AI7  D171     30.7%
118 Dayton, OH      $6259.00  AI4  Y345     28.2%
119 San Jose, CA    $5150.30  vI7  D871     25.1%
120 Dallas, TX      $9250.00  KI4  X355     23.2%
;
RUN;
 
 
OPTIONS PAPERSIZE=(20in 40in);
 
 
ODS PDF FILE='c:\temp\fccdata.pdf' startpage=no;
  PROC REPORT DATA=bdata nowd;
  COLUMNS(FCC Name Payment ID Section Ratio);
  WHERE obsid GT 0 AND obsid LE 40;
  RUN;
 
  PROC REPORT DATA=bdata nowd;
  COLUMNS(FCC Name Payment ID Section Ratio);
  WHERE obsid GT 40 AND obsid LE 80;
  RUN;
 
 
  PROC REPORT DATA=bdata nowd;
  COLUMNS(FCC Name Payment ID Section Ratio);
  WHERE obsid GT 80 AND obsid LE 120;
  RUN;
 
 
ODS PDF CLOSE;

Xia Keshan

Ask a Question
Discussion stats
  • 9 replies
  • 794 views
  • 0 likes
  • 6 in conversation