proc print - Is it possible to print only sum of a variable and not the grand total?

Reply
Occasional Contributor
Posts: 19

proc print - Is it possible to print only sum of a variable and not the grand total?

Is it possible to print only sum of a variable and not the grand total?

and also is it possible to suppress the group by variable appearing at the end?

SAS Super FREQ
Posts: 8,743

Re: proc print - Is it possible to print only sum of a variable and not the grand total?

Hi,

  I don't understand your question entirely and since you did not show any code, any data or any current output, then it is left to each person to imagine the report you are getting and the report you want. So, it's hard to figure out exactly what you mean. It seems you are using BY group processing. PROC PRINT is very "fixed" in the types of summary lines it will allow you to produce. PROC REPORT and PROC TABULATE are more flexible and the "go to" procedures if you need only certains types of summary information and do not wish to see the "detail" rows.

  For example, SASHELP.CLASS has 19 observations. Can you rewrite your PROC PRINT code using SASHELP.CLASS or SASHELP.CARS to illustrate your issue and to give everyone an example of what you're getting that you do NOT want? And then everyone is starting from the same point with a dataset that they all have access to. So it will be easy for them to grab your code and make suggestions.

cynthia

Occasional Contributor
Posts: 19

Re: proc print - Is it possible to print only sum of a variable and not the grand total?

Hey Cynthia,

Thanks a lot for both your replies, I said both https://communities.sas.com/thread/6610?start=0&tstart=0 look at his you will know why.

I used proc report and it fits very well for the requirement.

Contributor
Posts: 29

Re: proc print - Is it possible to print only sum of a variable and not the grand total?

Dear Venka,

Try Proc Summary as an Help, Hope it helps , illustrating with an example. Thanks.

Please try:

data revenue;
input LandCost Vendor $;
cards;
575 Express
510 World
540 World
720 Express
698 Express
425 World
468 Express
924 World
734 World
558 Express
;  Run;

proc sort data =  revenue; by  Vendor; run;

proc summary data =  revenue ;
class Vendor; var  LandCost;
output out = Rev1 (drop = _TYPE_ _FREQ_)

sum( LandCost) = sum_LC
;
RUN;

data rev2; set  rev1; if Vendor ~= ''; run;

Occasional Contributor
Posts: 19

Re: proc print - Is it possible to print only sum of a variable and not the grand total?

Hey sunilzood,

Thanks for your reply, I used proc report to solve my issue, thanks again for your help

Ask a Question
Discussion stats
  • 4 replies
  • 377 views
  • 0 likes
  • 3 in conversation