The SAS Output Delivery System and reporting techniques

Doubt on PROC Reports - Printing Multiple header and detail lines in 1 Page

Reply
N/A
Posts: 0

Doubt on PROC Reports - Printing Multiple header and detail lines in 1 Page

Hi All,

I have already posted this in "SAS Proc" forum then I thought this would be better place to post my question. Appreciate all your help....

I am having problem with my current coding.

I have a file with Department Id, Agent Id Month and Sales info. There will be 2 - 4 occurrence for a particular agent. I have to create a report for every agent with Agent Id and Department Id displayed on the top and Month and Sales Info as detailed lines. I am able to do one agent per page I am to put 3 agents per page but I couldn't. Any Help will be appreciated...

The Report should look like

ABC Insurance Co Page 1
XXx UUUU

Agent id : 12345
Department : P&C

Month Sales
-------------------------
01 $3,000.00
02 $3,000.00
01 $3,000.00


Agent id : 12345
Department : P&C

Month Sales
-------------------------
01 $3,000.00
02 $3,000.00
01 $3,000.00


Agent id : 12345
Department : P&C

Month Sales
-------------------------
01 $3,000.00
02 $3,000.00
01 $3,000.00

ABC Insurance Co Page 2
XXx UUUU

Agent id : 12345
Department : P&C

Month Sales
-------------------------
01 $3,000.00
02 $3,000.00
01 $3,000.00


Agent id : 12345
Department : P&C

Month Sales
-------------------------
01 $3,000.00
02 $3,000.00
01 $3,000.00


Agent id : 12345
Department : P&C

Month Sales
-------------------------
01 $3,000.00
02 $3,000.00
01 $3,000.00
Super Contributor
Posts: 394

Re: Doubt on PROC Reports - Printing Multiple header and detail lines in 1

MK,

I'm not sure I understand what you're after. There can be 2-4 occurrences per agent. You want to put 3 occurrences per page, is that right? Do all the occurrences have to be for a single agent? What happens if there are only 2 occurrences for an agent? If there are 4 occurrences for an agent do you want the first page to show 3 occurrences and the 2nd page to show only the 4th occurrence, or do you want to it to also show 2 occurrences for the next agent?

What ODS destination are you using? PDF? RTF?
N/A
Posts: 0

Re: Doubt on PROC Reports - Printing Multiple header and detail lines in 1 Page

Hi Tim,

Thanks for the response. I really appreciate this.

I am using SAS @ Z/OS. Its Batch Reporting in Mainframes and I have started using SAS recently and trying to learn as much as I can !!.

I have tried to explain the situation as much as can. Please let me know whether this makes sense to you

The requirement is to provide detailed report for each agent where the name, department will come on the top and sales detail per month will come as detailed line (Like the Bank statement where the address appears on the top and all your transactions appear in tabular format).

I have coded initially one agent in one page (using Compute before _page_ and Line statements to display Agent Id and then the detail lines but now I got an additional request to print 3 agents in one page so that we can save paper.

My data Looks like this (3 byte dept, 5 bytes Agent, 2 byte Month and Sales amount)

P&C 12345 01 1000000.00
P&C 12345 02 4000000.00
P&C 12345 03 3000000.00
P&C 12347 01 1000000.00
P&C 12347 02 4000000.00
P&C 12349 03 3000000.00
P&C 12349 01 1000000.00
P&C 12349 02 4000000.00
P&C 12349 03 3000000.00
LIF 10001 01 123456.00
LIF 10001 02 123456.00
LIF 10001 03 123456.00

and I want the report looks like this

ABC Insurance Co Page 1
XXx UUUU

Agent id : 12345
Department : P&C

Month Sales
-------------------------
01 $1000000.00
02 $1000000.00
03 $1000000.00

Agent id : 12347
Department : P&C

Month Sales
-------------------------
01 $3,000.00
02 $3,000.00
01 $3,000.00


Agent id : 12349
Department : P&C

Month Sales
-------------------------
01 $3,000.00
02 $3,000.00
01 $3,000.00

-------------------------new page after 3 agents ---------------------
ABC Insurance Co Page 2
XXx UUUU

Agent id : 100001
Department : LIF

Month Sales
-------------------------
01 $3,000.00
02 $3,000.00
01 $3,000.00
SAS Super FREQ
Posts: 8,745

Re: Doubt on PROC Reports - Printing Multiple header and detail lines in 1 Page

Hi:
Tim may have some other ideas based on your comments. My thoughts on your question/report are that a lot of folks do "batch" reporting on the Mainframe, but they still use ODS to create files that are then FTP'd to another platform or to a web server for viewing. It sounds to me, however, like you are NOT planning to use ODS. And that you want to generate text-based, LISTING window, SYSOUT DD type of output from your mainframe job. It almost seems like you're duplicating a COBOL or EASYTRIEVE report...this looks very like some of those reports I used to generate "back in the day".

If you want to generate output for the LISTING window or your SYSOUT DD on the mainframe, the kind of report that you outline is one that typically is done with DATA _NULL_ to FILE PRINT, using PUT statements. In that instance, you can write to the SYSOUT DD, use statements like PUT _PAGE_ and count the number of lines left on the page using FILE statement options.

You can come close to the report you want with PROC REPORT, but PROC REPORT does not generally repeat column headers between groups unless you are using BY group processing, and, generally with BY group processing, every BY group starts a new page. You could assign an arbitrary variable in your data so that you would identify the groups of 3 that should be on one page -- but by the time you're doing that for PROC REPORT, you may as well be writing PUT statements.

The documentation for the FILE statement and the PUT statement have a lot of examples of writing files to the LISTING window with DATA _NULL_ programs.

cynthia
N/A
Posts: 0

Re: Doubt on PROC Reports - Printing Multiple header and detail lines in 1 Page

Hi Cynthia and Tim,

Thanks for your time...
I was thinking about getting the "Report" created by PROC REPORT and remove the "ASA Print Character" that causes Page breaks whne the page number is other than 1 or when the remineder page / 3 gives me 1 but I was not sure whether its an elegant way to use SAS.

I hope to learn fast and wish to contribure to the forum soon...

Thanks once again
MK
SAS Super FREQ
Posts: 8,745

Re: Doubt on PROC Reports - Printing Multiple header and detail lines in 1 Page

Hi:
Without worrying about carriage control characters, the first thing you can do is determine what kind of printer you have available on the mainframe. If you can only use a fixed pitch font on your printer, then the default font that SAS uses for output to the LISTING window or SYSOUT DD is SAS Monospace (I believe this is also true on the Mainframe -- but you'd have to check.)

At any rate, given the use of SAS Monospace font, the amount of "text" you can get per page will vary depending on your output orientation and the fontsize that you get. The amount of text you can write per page will also depend on these factors and SAS generally would like to have these LINESIZE and PAGESIZE settings for the following orientation and font sizes:
[pre]
Orientation FontSize LineSize PageSize
Portrait 8pt 121 67
Portrait 10pt 97 54
Portrait 12pt 80 45
Landscape 8pt 158 50
Landscape 10pt 125 41
Landscape 12pt 105 34

[/pre]

I do remember that in the OLD old days, before fancy printers, the rule of thumb was that for a fixed pitch print train, you had 132 characters for Linesize and approx 50 lines per page for page size -- that was landscape orientation at 12 characters per inch on an 11" line and 6 lines per inch on an 8.5" page (you lose a bit off the top for printer alignment).


My mainframe days are long behind me; however, some examples of writing to FILE PRINT (SYSOUT DD) with a DATA _NULL_ program are here:
http://support.sas.com/kb/24/608.html
http://support.sas.com/kb/24/781.html
http://support.sas.com/kb/25/425.html
http://support.sas.com/kb/24/600.html
http://support.sas.com/kb/24/700.html
http://support.sas.com/kb/25/427.html
http://support.sas.com/kb/25/429.html
http://support.sas.com/kb/25/339.html

cynthia
N/A
Posts: 0

Re: Doubt on PROC Reports - Printing Multiple header and detail lines in 1 Page

Hi Cyntia,

Yes, I use fixed font (Courier new) here for printing. My requirement is to write SAS to create reports to validate the fancy ones (using AFP) created for mailing to make sure that everything worded ok.

You are right about the linesize 132 (it can have max 133) and the first character is a Carriage control (there will be an 1 @ position 1 for New page), I will explore the FILE and PUT options and the quick fix for me is to play with "Carriage Control".

Thanks
MK
N/A
Posts: 0

Re: Doubt on PROC Reports - Printing Multiple header and detail lines in 1 Page

Hi Cynthia and Tim,

I have created the report 1 agent per page using PROC report and then created the following code to force 3 pages to be printed in 1

DATA ISRRPT (KEEP=ASACHAR RPTLINE);
RETAIN PAGECNT;
RETAIN PAGEFOR3;

INFILE ISR;
INPUT @1 ASACHAR $CHAR1.
@2 RPTLINE $CHAR132.;

IF _N_ = 1 THEN DO;
PAGECNT = 0;
END;

IF ASACHAR = '1' THEN DO;
PAGECNT = PAGECNT + 1;
END;

PAGEFOR3 = MOD(PAGECNT, 3);
SELECT (PAGEFOR3);
WHEN (0) ASACHAR = ' ';
WHEN (1) ;
WHEN (2) ASACHAR = ' ';
OTHERWISE;
END;

FILE ISROUT;
PUT @1 ASACHAR $CHAR1.
@2 RPTLINE $CHAR132.
;

I will explore FILE and PUT options in the subsequent reports.

I appreciate your time and efforts
MK
Ask a Question
Discussion stats
  • 7 replies
  • 134 views
  • 0 likes
  • 3 in conversation