I have the following input data:
KEYS COL1 COL2 COL3 --- ---- ---- ---- 1 a1 b1 c1 1 a2 b2 c2 1 a3 b3 c3 2 a4 b4 c4 3 a5 b5 c5 4 a6 b6 c6 4 a7 b7 c7
If the table contains more than one record per key the report should print something like HEADER and it should be printed only when the key is changed. That HEADER is consist of COL1+COL2(concatenate). After the HEADER is printed the report should print COL2+COL3 for all records per key.So far so good but when there is only one record per key I need to print only the HEADER.
Here is an example of the output:
a1b1 <- HEADER COL1+COL2 b1c1 <- Line 1 COL2+COL3 b2c2 <- Line 2 COL2+COL3 b3c3 <- Line 3 COL2+COL3 a4b4 <- HEADER COL1+COL2 a5b5 <- HEADER COL1+COL2 a6b6 <- HEADER COL1+COL2 b6c6 <- Line 6 COL2+COL3 b7c7 <- Line 7 COL2+COL3
My idea was to use the HEADERS but when I have only one record per key that record should not be printed that means that I can use the HEADER.
Do you have any idea?
Output: HTML, PDF
SET ASNAMES = ON DEFINE FILE FP1 ROWNUM/I9 = LAST ROWNUM + 1; END TABLE FILE FP1 SUM CNT.KEYS AS 'KEYCNT' BY KEYS PRINT ROWNUM COMPUTE HEADER/A5 = IF C1 GT 1 AND KEYS NE LAST KEYS THEN 'Y' ELSE 'N'; COMPUTE COLA/A10 = COL1 | COL2; COMPUTE COLB/A10 = IF C1 EQ 1 THEN COL1 | COL2 ELSE COL2 | COL3 ; BY KEYS ON TABLE HOLD AS HOLD1 END TABLE FILE HOLD1 PRINT COLB AS '' BY ROWNUM NOPRINT ON ROWNUM SUBHEAD "<COLA " WHEN HEADER EQ 'Y' END
|Powered by Social Strata|