BookmarkSubscribeRSS Feed
Charlotte37
Fluorite | Level 6

Hi,

 

I created a report with proc report.

Per day, I have parcels in and out. Some packages have deadlines to respect (priority 1 ...). By priority, I count the number of packets processed within the time limit and those that did not respect the time limit.

 

I am using the "break after" function to get the totals by week.

I would like to add a line (under the totals per week), in yellow on the photo, allowing to calculate the percentages by priority.

For example, 58,82% = 10 / (10+7)

 

Is-it possible with the proc report ?

 

Thanks,

 

Charlotte37_0-1612957833447.png

 

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

Yes. Post sample data to get a usable code answer 🙂

Charlotte37
Fluorite | Level 6

An example :

 

 

DATA test;
LENGTH
Priorite $ 10
Date 8
semaine $20.
OK 8
KO 8;
FORMAT
Priorite $CHAR10.
Date DDMMYY10.
semaine $20.
OK 8.
KO 8.;
INFORMAT
Priorite $CHAR10.
Date DDMMYY10.
semaine $20.
OK 8.
KO 8.;
INPUT
Priorite : $CHAR10.
Date : DDMMYY10.
semaine : $20.
OK : 8.
KO : 8.;
CARDS;
P1 08/02/2021 6 1 0
P1 08/02/2021 6 1 0
P1 08/02/2021 6 0 1
P1 08/02/2021 6 1 0
P1 08/02/2021 6 0 1
P1 08/02/2021 6 1 0
P2 08/02/2021 6 0 1
P2 08/02/2021 6 1 0
P2 08/02/2021 6 1 0
P2 08/02/2021 6 1 0
P1 09/02/2021 6 1 0
P1 09/02/2021 6 1 0
P1 09/02/2021 6 0 1
P1 09/02/2021 6 0 1
P1 09/02/2021 6 1 0
P1 09/02/2021 6 1 0
P1 09/02/2021 6 0 1
P1 09/02/2021 6 1 0
P2 09/02/2021 6 0 1
P2 09/02/2021 6 1 0
P2 09/02/2021 6 1 0
P2 09/02/2021 6 0 1
P2 09/02/2021 6 1 0
P2 09/02/2021 6 1 0
P2 09/02/2021 6 1 0
P2 09/02/2021 6 0 1
P2 09/02/2021 6 1 0
P2 09/02/2021 6 1 0
P2 09/02/2021 6 1 0
P2 09/02/2021 6 1 0
;
run;

proc report data=test nowd;
column semaine date;
column priorite, (ok ko);

define date / group missing '';
define semaine / group missing 'Semaine';

define priorite / across missing "";
define ok / analysis SUM "OK";
define ko / analysis SUM "KO";

break after semaine / summarize;

compute after semaine;
if upcase(_break_) = 'SEMAINE' then do;
semaine="Semaine " ||semaine;
end;
endcomp;
run;

 

ballardw
Super User

Code currently using as well.

 

 

Charlotte37
Fluorite | Level 6

Sorry, I don't understand 

Charlotte37
Fluorite | Level 6
Hello,
I relaunch my subject. Is there a solution ?
Cynthia_sas
SAS Super FREQ
Hi: Look at some of the more complex break processing examples in this paper
https://support.sas.com/resources/papers/proceedings17/SAS0431-2017.pdf -- in particular, look at the compute block example #5 where extra break lines are put into the report. Your example would not need so many extra break lines, but I think you might need some extra helper variables. It's not clear to me exactly how your percent on the extra row is being calculated.
Cynthia

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1056 views
  • 0 likes
  • 4 in conversation