sas >> Questions on Proc Print/Proc Report

by Nikhil Sardesai » Fri, 05 Nov 2004 15:45:13 GMT

Hi,

I would appreciate some help on Proc Print/Proc Report.

My problem: I want to put the literal word "Total" in the summary line of
proc print/proc report.

The report should look like:
ColA ColB
1 10
2 20
3 30
4 40
Total $100

I dont know how to do it in proc print.
In proc report I can do it by decalring earlier columns (ColA here)
ColA="Total" if ColA is a character column. But alas my column is a numeric.

An alternative is using the line statement within computeafter block in Proc
Report but then I lose the alignment of the total "$100" with the actual
column, as I have to define what column I want to print it, @10ColB.sum
dollar10.

The sum is sometimes quite large then the actual values in the column to be
summed up. Strangely enough I cant increase the width by the width= option
in the define statement of the column. So my alignement in the line
statement goes for a toss.

Here is a sample proc report I am using
proc report data=SortRpt nowd colwidth=10 spacing=5 headline headskip ;

column ColA ColB;

define ColA / style(HEADER) = [ just=r ] 'ColA';

define ColB/ width=20 style(HEADER) = [ just=c] 'ColB';


rbreak after/ page dol summarize;

compute after /

style=[font_style=roman font_size=3 font_weight=bold ];\

line "Total" @10ColB.sum format dollar10.;

endcomp;

run;


Thanks for any guidance.

Nikhil Sardesai



sas >> Questions on Proc Print/Proc Report

by mbraten » Fri, 05 Nov 2004 22:49:01 GMT


In proc report you can add the literal to the summary line.

Your coding requires the following changes assuming that the ODS stuff
does not get in the way:


proc report data=SortRpt nowd colwidth=10 spacing=5 headline headskip ;
column ColA ColB;

define ColA / GROUP style(HEADER) = [ just=r ] 'ColA';

define ColB/ ANALYSIS SUM width=20 style(HEADER) = [ just=c] 'ColB';


rbreak after/ page dol summarize;

compute after /

style=[font_style=roman font_size=3 font_weight=bold ];\

ColA= "Total" ;

endcomp;

run;


-----Original Message-----
From: SAS(r) Discussion [mailto: XXXX@XXXXX.COM ] On Behalf Of
Nikhil Sardesai
Sent: Friday, November 05, 2004 2:45 AM
To: XXXX@XXXXX.COM
Subject: Questions on Proc Print/Proc Report

Hi,

I would appreciate some help on Proc Print/Proc Report.

My problem: I want to put the literal word "Total" in the summary line
of
proc print/proc report.

The report should look like:
ColA ColB
1 10
2 20
3 30
4 40
Total $100

I dont know how to do it in proc print.
In proc report I can do it by decalring earlier columns (ColA here)
ColA="Total" if ColA is a character column. But alas my column is a
numeric.

An alternative is using the line statement within computeafter block in
Proc
Report but then I lose the alignment of the total "$100" with the actual
column, as I have to define what column I want to print it, @10ColB.sum
dollar10.

The sum is sometimes quite large then the actual values in the column to
be
summed up. Strangely enough I cant increase the width by the width=
option
in the define statement of the column. So my alignement in the line
statement goes for a toss.

Here is a sample proc report I am using
proc report data=SortRpt nowd colwidth=10 spacing=5 headline headskip ;

column ColA ColB;

define ColA / style(HEADER) = [ just=r ] 'ColA';

define ColB/ width=20 style(HEADER) = [ just=c] 'ColB';


rbreak after/ page dol summarize;

compute after /

style=[font_style=roman font_size=3 font_weight=bold ];\

line "Total" @10ColB.sum format dollar10.;

endcomp;

run;


Thanks for any guidance.

Nikhil Sardesai


***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************

sas >> Questions on Proc Print/Proc Report

by Nikhil.Sardesai » Tue, 09 Nov 2004 16:19:04 GMT

Hi Michael,

Thanks for your reply. As I had mentioned since ColA is numeric it gives
error when I am trying to equate it to a character value("Total"). I tried
running your suggestions but I have the same problem.

Regards,

Nikhil Sardesai

Similar Threads

1. Simple proc report question: why printing sums?

2. Proc Report, Proc Print output simple enough maybe

data dumptest; 
  VIEW_ID=934; 
  Commodity_class_id = 870000001; 
  Geo_src_class_id = 70; 
  Geo_dest_class_id = 1001; 
  Bus_src_class_id = 72; 
  Bus_dest_class_id = 72; 
  Dp_key = '10101010'; 
  Commodity_code = '1101'; 
  Geo_src_code = '1'; 
  Geo_dest_code = '0'; 
  Bus_src_code = '99'; 
  Bus_dest_code = '99'; 
  Macro_pool = 113; 
  Macro_model = 990; 
run; 

One record in the file.
Need a Proc Report to produce a listing as follows.   Well, a little more lined
up than shown. Just a dump really. 

VIEW_ID: 934     Commodity_class_id: 870000001 Geo_src_class_id: 70
Geo_dest_class_id: 1001 Bus_src_class_id: 72 Bus_dest_class_id: 72 Dp_key:
10101010 Commodity_code: 1101          Geo_src_code: 1      Geo_dest_code: 0   
    Bus_src_code: 99     Bus_dest_code: 99 Macro_pool: 113; Macro_model: 990; 


I don't think it is possible, but if it is please advise.
I need it as a Proc Report or Proc Print because it goes at the bottom of a
group of activex graphs produced using ODS. Guess I should try a Data _null_;
put .... first though. ? Or I probably have to do some heavy annotate lifting.
:-( Thanks!

3. PROC TABULATE or PROC REPORT : newby question

4. Question on Proc Freq, Proc Tabulate, and reporting..

From one fish bowl to another..

An interesting problem on my part, but likely a simple answer.

Background:
I have variables from an input data set for which I assign a format and label.

Ex.
LABEL q1=If you plan on taking to trip to Europe, when do you intend to do so?
q2=If you plan on taking to trip to Asia, when do you intend to do so?

FORMAT (For both q1 and q2)
1 = One year from now
2 = Two years from now
3 = Three years from now
4 = Four years from now
5 = 5 years from now
6 = more than 5 years from now

So when I run
PROC FREQ DATA=blah
TABLES q1 -- q2;
RUN;

I get a standard frequency table with a label to describe the variable AND
the formats attached to their relative frequency

(Ie.
 "If you plan on taking..."
 One year from now  1
 ...
 More than 5 years  5
)

These tables are merely one-way frequency tables.

PROBLEM:
I've now been asked to take all of these variables and consolidate them into a
table that would look like the following:


Column 1  Column 2 .. Column 8
(Locale)  One year from now ... More than 5 years
Europe
Asia
Australia

The requestor is basically asking that I flip the table and merge the results
Is there a simple or straight-forward method of doing this?

(Or am I going to be running multiple out options in Proc Freq followed by
 multiple Proc Transpose with a final data set to merge the results?)


Signed a data step cruncher now lost in the wilds of SAS report writing..
Chris Amherst

5. PROC REPORT print character vairable with line command

6. PROC REPORT print character variable with line command

7. Proc Report and Double Sided Printing

8. printing graphic images in SAS ODS PROC REPORT

A letter with a graphic image prints with a transparent background in MS
Word but not when rendered as a pdf under SAS ODS Proc Report. The
problem may occur in the method of display in the Adobe Acrobat reader
or in the method specified by SAS. Has anyone encountered this problem
and found a solution. Thanks in advance for any help that you might
offer.
Sig