Contributor
Posts: 42

# Proc Report Computed Variables.

Hi All,

I am attempting to establish the ratio of claims to covers.

The code I have created is as follows and it results in a "." in the new variable Frequency. I have read a dozen documents on Proc Report, but just can't seem to do this simple task.

Does anyone have any ideas?

column coveragecode EarnedCov Claimcount Frequency;
define coveragecode / group;
define Cov / analysis sum;
define count / analysis sum;
define Frequency / computed;

compute Frequency;
if Coveragecode = 'MC' then Frequency = sum(Claimcount/EarnedCov);
endcomp;
run;

Regards,
Scott
Not applicable
Posts: 0

## Re: Proc Report Computed Variables.

I'm not sure about that use of the sum function. Sum should be uused for summing, not division. If you have version 9.2 you will have the divide function available to you.

http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a003105093.htm

Other wise just do a division without the sum round it.
SAS Super FREQ
Posts: 9,365

## Re: Proc Report Computed Variables.

Hi:
Proc Report requires that you use a specific type of variable reference for analysis variables in your COMPUTE block.
So, for example, if I wanted to divide height by age in this program:
[pre]
proc report data=sashelp.class nowd;
column name age height divided;
define name / order;
define age / sum;
define height / sum;
define divided / computed;
compute divided;
divided = height.sum / age.sum;
endcomp;
run;
[/pre]

To make this work, I have to give DIVIDED (my new report item) a usage of "COMPUTED". Then, I need a compute block for divided. Since I defined AGE and HEIGHT as analysis variables with a usage of 'SUM', then I need to ALSO use their "compound names" in the COMPUTE block for DIVIDED. Those compound names are:
varname.statistic
which means age.sum and height.sum need to be used in the compute block.

So you were -almost- there try this:
[pre]
if Coveragecode = 'MC' then Frequency = Claimcount.sum / EarnedCov.sum;
[/pre]

cynthia
Contributor
Posts: 42