BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
blast
Fluorite | Level 6

Hi , 

I have a very simple question on the proc report.

data have;
format date ddmmyy10.;
input date  nature :$20. montant ;
datalines;
12926 test 	100
14926 test 	200
18926 test2 500
25926 test2 50
;
run;

proc report data=have ;
column ("Flux " date nature montant);
define date 		/ display 'Date de Saisie';
define nature  		/ display 'Type';
define montant    	/ display 'Mt';
run;

I want to had on the botom 2 subtotal lines, like this :  

 

Capture1.JPG

 

Is that possible with a proc report without ordering / grouping the date ?  

 

thanks 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

HI:

  As an alternative, here's how you would achieve the report just using some "helper" variables and PROC REPORT with COMPUTE blocks. In this example, #1 and #2 are just the steps that lead to #3, which is the final report. This PROC REPORT is based on using the helper variables, as created in the modified DATA step program.

Cynthia_sas_0-1669320770770.png

Cynthia

View solution in original post

2 REPLIES 2
Ksharp
Super User

It is not right way to do this within a PROC REPORT.

You need pre-process your data before PROC REPORT.

 

 

data have;
format date ddmmyy10.;
input date  nature :$20. montant ;
datalines;
12926 test 	100
14926 test 	200
18926 test2 500
25926 test2 50
;
run;

proc report data=have ;
column ("Flux " date nature montant) dummy;
define date 		/ display 'Date de Saisie';
define nature  		/ display 'Type';
define montant    	/ display 'Mt';
define dummy/computed noprint;
compute dummy;
if nature='test' then test+montant;
if nature='test2' then test2+montant;
endcomp;
compute after/style={just=l};
line ' ';
line   'Total' @25 'test' @35 test;
line   'Total' @25 'test2' @35 test2;
endcomp;
run;

Ksharp_0-1669262034171.png

 

Cynthia_sas
Diamond | Level 26

HI:

  As an alternative, here's how you would achieve the report just using some "helper" variables and PROC REPORT with COMPUTE blocks. In this example, #1 and #2 are just the steps that lead to #3, which is the final report. This PROC REPORT is based on using the helper variables, as created in the modified DATA step program.

Cynthia_sas_0-1669320770770.png

Cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1136 views
  • 1 like
  • 3 in conversation