LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 1998, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 20 Feb 1998 10:56:18 PST
Reply-To:     TWB2%Rates%FAR@bangate.pge.com
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         Tim Berryhill 3rd time <TWB2%Rates%FAR@BANGATE.PGE.COM>
Subject:      Re: Custom Output help needed
Comments: To: Jbp797 <jbp797@AOL.COM>
Content-Type: text/plain; charset=us-ascii

Joan, Clearly you cannot print 228 characters on a 132 character line. Besides, SAS currently (6.09 MVS) limits character variables to 200 characters, so $228. will not satisfy you. Allow me to assume a dataset with LCOUNT and COMMENT1-COMMENT3, where COMMENT1-COMMENT3 are $76. Suppose I decide there are 60 columns available on the right side of the invoice for comments. Using PROC PRINT, I might code:

DATA REPORT(KEEP=CUST INVOICE INVDATE RESP COMMENT); SET RAW(KEEP=CUST INVOICE INVDATE RESP LCOUNT COMMENT1-COMMENT3); LENGTH COMMENT $60; * Copy first 60 chars of COMMENT1; COMMENT=COMMENT1; OUTPUT; IF LCOUNT GT 1 OR SUBSTR(COMMENT1,61,16) GT '' THEN DO; * This will be second line--make most fields blank; CUST='';INVOICE='';INVDATE=.;RESP=''; COMMENT=SUBSTR(COMMENT1,61,16)||SUBSTR(COMMENT2,1,44); OUTPUT; END; IF LCOUNT GT 2 OR SUBSTR(COMMENT2,45,32) GT '' THEN DO; * Third line; COMMENT=SUBSTR(COMMENT2,45,32)||SUBSTR(COMMENT3,1,28); OUTPUT; END; IF SUBSTR(COMMENT3,29,42) GT '' THEN DO; * Final line; COMMENT=SUBSTR(COMMENT3,29,42); OUTPUT; END; RUN;

OPTION MISSING ' '; PROC PRINT DATA=REPORT; RUN;

The idea is to cut the three comment variables into 60 character pieces and write the first 60 into one ob (part of COMMENT1), then the rest of COMMENT1 and part of COMMENT2... Your example did not repeat the customer number or other fields on subsequent records, so I set them all to missing. I use OPTION MISSING ' ' because INVDATE is a numeric value and I do not want to print dots on the second, third and fourth lines of the report for each invoice. Depending on the quality of your comment fields, it might be worth splitting between words. That is complicated.

I would probably write this in a DATA _NULL_ instead, but the logic for chopping up the comment fields would be similar.

Tim Berryhill - Contract Programmer and General Wizard TWB2@PGE.COM or http://www.aartwolf.com/twb.html Frequently at Pacific Gas & Electric Co., San Francisco The correlation coefficient between their views and my postings is slightly less than 0 ----------------------[Reply - Original Message]----------------------

Sent by:"Jbp797" <jbp797@AOL.COM> Since I've never done any fancy reporting with SAS, I thought I'd ask for help here.

Most of the reports I've created using proc print. The report I'm currently working on deals with output that goes like this:

Customer # Invoice Invoice Date Resp Inv literal comments $11 $6 yymmdd6 $4 $228

It's this last field that throws me. the literal comments are brought in from a dataset where this is a possible 3 line comment @ 76 char./line. There is a field before this in the input dataset that is LCOUNT which can be 1,2 or 3 depending on how long this comment is. I need to produce a report that if the specific invoices I'm looking for have 1 or all of the comments attached, I need to show these. Problem is after 132 it truncates, of course. I'm trying to find a way to maybe produce this:

Line1 Customer # Invoice Invoice Date Resp Inv literal comments #1 Line 2 "blank for same invoice " Inv literal comments #2 Line 3 "blank for same invoice " Inv literal comments #3

Can anyone help? I've tried looking for examples and I can't find any. Thanks in advance....Joan

=====================================================================


Back to: Top of message | Previous page | Main SAS-L page