Desktop productivity for business analysts and programmers

Problem in getting the proper through Proc Report

Reply
N/A
Posts: 0

Problem in getting the proper through Proc Report

Hi,

I am not getting the perfect output through proc report.

Layout of my report

branch name internal Grn External Grn order no Cost ...

Supplier: ACTIV-AIR AUTOMATION LTD

3010 XYZ Gloucester 123 10000 1 1000
--------
Total for Supplier ACTIV-AIR AUTOMATION LTD 1000
---------


End of report

The problem in this layout is that i am getting the same output but the line for total for supplier is taking the width of branch ,I wouls like to make it independent.

I am sending you the code also.

options nobyline;


proc report data=WORK.QUERY3051 nowd headskip split='*' spacing=1;
column Cf_Su_Name Gb_Br_Name
Pi_In_Grnno Pi_In_Grn Pi_In_Orderno Pi_In_Ordtype Pi_In_Partno
Pi_In_Grndate Pi_In_Recqty Pi_In_Recgoods Pi_In_Recprice;
title1 'PTS BM_SREP0370 Purchase Reserve Report BY Supplier 16/09/07';
title2 ' =================================== ';

define Cf_Su_Name /group noprint ;
define Gb_Br_Name / group noprint ;
define Gb_Br_Name_1 /computed 'Branch Name';
define Pi_In_Grnno / order width=8;
define Pi_In_Grn / ' Supplier* GRN No' order width=10;
define Pi_In_Orderno / order width=10;
define Pi_In_Ordtype / 'Order*Type' flow width=5;
define Pi_In_Partno / order width=8;
define Pi_In_Grndate / order width=10;
define Pi_In_Recqty / 'Quantity*Received' SUM format=8.;
define Pi_In_Recgoods / 'Net*Goods*Value' SUM format=comma8.2;
define Pi_In_Recprice / 'Net*Purchase*Cost' SUM format=comma8.2;
rbreak after / summarize;
compute before Cf_Su_Name;
line @2 'Supplier: ' Cf_Su_Name $25. ;
line ' ';
endcomp;
break after Cf_Su_Name / summarize OL ul skip;
compute Gb_Br_Name_1/char length=45;
if _break_='Cf_Su_Name' then
Gb_Br_Name_1='Total for Supplier ' || Cf_Su_Name ;
else Gb_Br_Name_1=Gb_Br_Name;
endcomp;
compute after ;
Gb_Br_Name= 'Company Total ' ;
endcomp;
run;

Can you get the solution.
SAS Super FREQ
Posts: 8,720

Re: Problem in getting the proper through Proc Report

Hi...I see one problem:
[pre]
define Gb_Br_Name / group noprint ;

compute after ;
Gb_Br_Name= 'Company Total ' ;
endcomp;

[/pre]
Gb_Br_Name is a noprint variable, so you're probably not seeing "Company Total" -- unless that was a typo.

I don't understand what you mean by:
"line for total for supplier is taking the width of branch"

because in your code, you have:
[pre]
define Gb_Br_Name_1 /computed 'Branch Name';

compute Gb_Br_Name_1/char length=45;
if _break_='Cf_Su_Name' then
Gb_Br_Name_1='Total for Supplier ' || Cf_Su_Name ;
else Gb_Br_Name_1=Gb_Br_Name;
endcomp;

[/pre]
You have assigned Gb_Br_Name_1 a length of 45. At the break of Cf_Su_Name, you assign the value of Gb_Br_Name_1 to be the concatenated
string:
[pre]
Total for Supplier xx whatever the Cf_Su_Name isxxxx

[/pre]
So on that break row only, your code is changing the value in the cell for Gb_Br_Name_1 -- this is not an independent "line" -- this is the line that automatically comes because of the BREAK statement for Cf_Su_Name and you are essentially "renaming" what would otherwise be in the column for Gb_Br_Name_1 -- on that row's report line.

Your only other option at this break is to write your own line with a LINE statement -- similar to what you do with your compute before block. I highly recommend the PROC REPORT documentation on the use of BREAK statements and LINE statements, especially the following help topics:
Concepts: REPORT Procedure
How PROC REPORT Builds a Report
Construction of Summary Lines


cynthia
Ask a Question
Discussion stats
  • 1 reply
  • 82 views
  • 0 likes
  • 2 in conversation