BookmarkSubscribeRSS Feed
Scottcom4
Calcite | Level 5
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?

proc report data=Merged headline headskip;
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
3 REPLIES 3
deleted_user
Not applicable
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.
Cynthia_sas
Diamond | Level 26
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
Scottcom4
Calcite | Level 5
Thank you Cyntia. You are a gem.

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
  • 3 replies
  • 1448 views
  • 0 likes
  • 3 in conversation