Help using Base SAS procedures

Proc Tabulate: How do I do average % ?

Reply
Frequent Contributor
Posts: 78

Proc Tabulate: How do I do average % ?

Hi there,

I tabulating my results as below.

I would like to create an extra column known as
claim_freq and this column is basically take from the fomula of Total SUM of claimCount / Total SUM of epy

can someone help me out on this one please?

Proc Tabulate Data = SummaryTable;
Class FRUITS;
Var claimCount epy incurToDate earnedPrem;
Table ALL FRUITS,
SUM*claimCount, SUM*epy, MEAN*(claim_freq= SUM of claimCount / SUM of epy ) ;
Run;
SAS Employee
Posts: 105

Re: Proc Tabulate: How do I do average % ?

Hi Yennie,
You cant create new vars on proc tabulate procedure,
You can do it with proc report or to manipulate the data before....
PROC Star
Posts: 1,561

Re: Proc Tabulate: How do I do average % ?

Like so?

proc tabulate data = sashelp.class;
class SEX;
var WEIGHT HEIGHT ;
table (all SEX) ,HEIGHT*sum WEIGHT*sum WEIGHT*pctsum='Ratio' ;
run;
Frequent Contributor
Posts: 78

Re: Proc Tabulate: How do I do average % ?

Hi Chris,

thanks heaps on this one! Do you know what happen if it's just for average price $.

whereby say the claims cost per policy is = total amount of money inccured to date/ number of days acrrued ... not in percentage though.. it's dollar6.2.

cheers.
PROC Star
Posts: 1,561

Re: Proc Tabulate: How do I do average % ?

You mean the ratio (cost per policy) has to be done at observation level? and then you derive the mean of the ratios?
If so, you must compute the individual ratios before hand, proc tabulate cannot do the record-level calculation.
Having said that, the mean of the ratios seems wrong in this case.
The ratio of the sums is the number you want if I understand your data properly.
Valued Guide
Posts: 2,175

Re: Proc Tabulate: How do I do average % ?

ratios in Tabulate?
no problem!
(well .. almost no problem)
Just use pctsum on analysis variable for numerator and point denominator definition to the denominator of the ratio.
After that, you just need to tame the tabulate tendancy to present the result as percentage points with 10% as 10 and not .10, but proc format solves that too!
[pre]Proc format ;
picture mnyR(round) other = '00,000,001.23'( mult=1 prefix='$' ) ;
run;[/pre] * seems it needs that MULT=1 !;[pre]Proc Tabulate Data= SummaryTable ;
Class FRUITS ;
Var claimCount epy incurToDate earnedPrem ;
Table ALL FRUITS
, SUM=' '*claimCount SUM=' '*epy
claimCount=' '*pctsum='claim freq' *f= mnyR. ;
Run ; [/pre]
not quite sure why it is claimCount/epy, but hope the description above will clarify alternative ratios.

PeterC forgot to add the $
Message was edited by: Peter.C
Ask a Question
Discussion stats
  • 5 replies
  • 149 views
  • 0 likes
  • 4 in conversation