BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

data Exception;

format ex_date1 MMYYD.;

infile datalines;

input ex_date1 date9. Exception $ exc_cnt;

return;

datalines;

01Aug2019 Aged 1

01Aug2019 Current 11

01Sep2019 Expired 22

01Sep2019 Aged 1

01Aug2019 Aged 44

01Oct2019 Expired 4

;

data Exception_;

length Exception $30.;

set Exception;

exc_date=put(ex_date1,MMYYD.);

run;

 

data Actions;

length Action $30.;

format act_date1 MMYYD.;

infile datalines;

input act_date1 date9. Action $ act_cnt;

return;

datalines;

01Aug2019 Terminate 122

01Aug2019 Resch 1229

01Sep2019 Resch 850

01Sep2019 Research 2022

01Aug2019 Terminate 652

01Oct2019 Terminate 91

;

data Actions_;

set Actions;

act_date=put(act_date1,MMYYD.);

run;

 

proc report data=exception_ wrap style(column)={just=center};

title 'Final';

column Exception exc_date exc_cnt ;

define Exception / group style (column)=[cellwidth=100pt] "Exception Type";

define exc_date /across style(column)=[cellwidth=100pt]'';

define exc_cnt / sum "Exceptions" style(column)=[cellwidth=90pt];

rbreak after / summarize style (summary)= Header;

compute after;

Exception = 'Total Exceptions';

/*act_cnt = 'Total Actions';*/

endcomp;

run;

title;

 

proc report data=actions_ wrap style(column)={just=center};

column Action act_date act_cnt ;

define Action / group style (column)=[cellwidth=100pt] "Action Type";

define act_date /across style(column)=[cellwidth=100pt]'';

define act_cnt / sum "Actions" style(column)=[cellwidth=90pt];

rbreak after / summarize style (summary)= Header;

compute after;

Action = 'Total Actions';

/*act_cnt = 'Total Actions';*/

endcomp;

run;

 

Results

Exception Type

08-2019

09-2019

10-2019

Exceptions

Aged

2

1

0

46

Current

1

0

0

11

Expired

0

1

1

26

Total Exceptions

3

2

1

83

 

Action Type

08-2019

09-2019

10-2019

Actions

Resch

1

1

0

2079

Research

0

1

0

2022

Terminate

2

0

1

865

Total Actions

3

2

1

4966

 

I want to bring these two together and show the results as follows:

Exception Type

08-2019

09-2019

10-2019

Total

Aged

2

1

0

46

Current

1

0

0

11

Expired

0

1

1

26

Total Exceptions

3

2

1

83

 Total Actions

3

2

1

4966

Exception Rate                           %                                     %

Exception Rate   the formula should be the total exception/total actions across

1 REPLY 1
PaigeMiller
Diamond | Level 26

I would do the calculations in PROC SUMMARY (one PROC SUMMARY for each data set), then combine the output data sets from PROC SUMMARY so that they match the requirements you have, then use PROC REPORT on this combined data set to make the final table.

--
Paige Miller

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 16. 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
  • 1 reply
  • 282 views
  • 1 like
  • 2 in conversation