turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- Proc Report Computed Variables.

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-03-2009 01:30 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-03-2009 05:24 AM

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.

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

Other wise just do a division without the sum round it.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-03-2009 11:07 AM

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

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:

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

03-03-2009 08:21 PM

Thank you Cyntia. You are a gem.