The SAS Output Delivery System and reporting techniques

ods pdf

Accepted Solution Solved
Reply
Regular Contributor
Posts: 228
Accepted Solution

ods pdf

Hi,

 

I am trying to create a report using ods pdf proc report and separating the dataset into separate tables on different pages using "BY Customer_Number". This part works fine. The problem I am having is that I would like extract the appropriate Customer_Number, Name and Address and placing these corresponding values in the title on each page that represent the appropriate data results. The dataset that I using for the report is similiar to the one below:

 

Customer_Number

Name

Address

Item_Number

Sale_Price

1654

Smith J.

123 Lowe

23127687

100.34

1654

Smith J.

123 Lowe

32146745

54.35

1721

Anderson B.

34 Buffalo

11450955

37.89

1922

Rae S.

6709 Mayfair

78663456

115.78

 

 

I would like the pdf file to look like the following where the first row is actually the title:

 

1654

Smith J.

123 Lowe

 

Item_Number

Sale_Price

 

23127687

100.34

 

32146745

54.35

 

 

1721

Anderson B.

34 Buffalo

 

Item_Number

Sale_Price

 

11450955

37.89

 

 

1922

Rae S.

6709 Mayfair

 

Item_Number

Sale_Price

 

78663456

115.78

 

I wonder if someone can help...thanks...


Accepted Solutions
Solution
‎09-25-2015 06:23 AM
SAS Super FREQ
Posts: 8,818

Re: ods pdf

Well, you don't show your BY statement -- are the data sorted by all 3 BY variables? In order to use #BYVAL you either use the syntax #BYVAL(varname) or #BYVAL1, #BYVAL2. I believe if you are going to use the numbers as reference, you don't use parens with the number form. Check the doc.

cynthia

View solution in original post


All Replies
SAS Super FREQ
Posts: 8,818

Re: ods pdf

Hi:
Look up the use of #BYVAR and #BYVAL special syntax commands, which are ways for you to use BY variables in the TITLE statement on your reports from many different procedures (not just PROC REPORT). I believe there have been previous postings on the use of #BYVAR and #BYVAL and I know there are examples in the documentation. So it should be fairly easy to find.

cynthia
Regular Contributor
Posts: 228

Re: ods pdf

Hi Cynthia, I may not have been clear to exactly what I was hoping to achieve. I was hoping that I would be able to Call these BY Values into a title statement such as in title statement TITLE3 in the following: TITLE1 JUSTIFY=CENTER BOLD HEIGHT=12PT FONT="Arial" "Listing of Sales"; TITLE2 " "; TITLE3 JUSTIFY=LEFT HEIGHT=9PT FONT=Arial "Customer Number: #BYVAL(1)" JUSTIFY=CENTER "Name: #BYVAL(2)" JUSTIFY=RIGHT "Address: #BYVAL(3)"; TITLE4 " "; TITLE5 "^{style[bordertopwidth=2px bordertopcolor=black] &tstr}";
Solution
‎09-25-2015 06:23 AM
SAS Super FREQ
Posts: 8,818

Re: ods pdf

Well, you don't show your BY statement -- are the data sorted by all 3 BY variables? In order to use #BYVAL you either use the syntax #BYVAL(varname) or #BYVAL1, #BYVAL2. I believe if you are going to use the numbers as reference, you don't use parens with the number form. Check the doc.

cynthia
Super User
Posts: 9,865

Re: ods pdf

You'd better post a picture to display what output you need . What is your output destination ? PDF RTF ?
data have;
input (Customer_Number Name Address) (&$20.) Item_Number Sale_Price ;
cards;
1654  Smith J.  123 Lowe  23127687  100.34
1654  Smith J.  123 Lowe  32146745  54.35
1721  Anderson B.  34 Buffalo  11450955  37.89
1922  Rae S.  6709 Mayfair  78663456  115.78
;
run;

proc report data=have nowd noheader;
column Customer_Number Name Address dummy Item_Number Sale_Price;
define Customer_Number /order noprint;
define Name /order noprint;
define Address /order noprint;
define dummy/computed ;
compute dummy/char length=10;
 dummy=' ';
endcomp;
compute before Address ;
 line @1 Customer_Number $20. +4 Name $20. +4 Address $20. ;
 line @22 "Item_Number" +20 "Sale_Price";
endcomp;
quit;

z.png
🔒 This topic is solved and locked.

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

Discussion stats
  • 4 replies
  • 599 views
  • 0 likes
  • 3 in conversation