<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Proc Report Computed Variables. in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Computed-Variables/m-p/76082#M22092</link>
    <description>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.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a003105093.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a003105093.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Other wise just do a division without the sum round it.</description>
    <pubDate>Tue, 03 Mar 2009 10:24:21 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-03-03T10:24:21Z</dc:date>
    <item>
      <title>Proc Report Computed Variables.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Computed-Variables/m-p/76081#M22091</link>
      <description>Hi All,&lt;BR /&gt;
&lt;BR /&gt;
I am attempting to establish the ratio of claims to covers.&lt;BR /&gt;
&lt;BR /&gt;
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.&lt;BR /&gt;
&lt;BR /&gt;
Does anyone have any ideas?&lt;BR /&gt;
&lt;BR /&gt;
proc report data=Merged headline headskip;&lt;BR /&gt;
   column coveragecode EarnedCov Claimcount Frequency;&lt;BR /&gt;
   define coveragecode / group;&lt;BR /&gt;
   define Cov  / analysis sum;&lt;BR /&gt;
   define count / analysis sum;&lt;BR /&gt;
   define Frequency / computed;&lt;BR /&gt;
&lt;BR /&gt;
   compute Frequency;&lt;BR /&gt;
      if Coveragecode = 'MC' then Frequency = sum(Claimcount/EarnedCov);&lt;BR /&gt;
   endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Scott</description>
      <pubDate>Tue, 03 Mar 2009 06:30:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Computed-Variables/m-p/76081#M22091</guid>
      <dc:creator>Scottcom4</dc:creator>
      <dc:date>2009-03-03T06:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report Computed Variables.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Computed-Variables/m-p/76082#M22092</link>
      <description>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.&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a003105093.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a003105093.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Other wise just do a division without the sum round it.</description>
      <pubDate>Tue, 03 Mar 2009 10:24:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Computed-Variables/m-p/76082#M22092</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-03-03T10:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report Computed Variables.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Computed-Variables/m-p/76083#M22093</link>
      <description>Hi:&lt;BR /&gt;
  Proc Report requires that you use a specific type of variable reference for analysis variables in your COMPUTE block.&lt;BR /&gt;
  So, for example, if I wanted to divide height by age in this program:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc report data=sashelp.class nowd;&lt;BR /&gt;
  column name age height divided;&lt;BR /&gt;
  define name / order;&lt;BR /&gt;
  define age / sum;&lt;BR /&gt;
  define height / sum;&lt;BR /&gt;
  define divided / computed;&lt;BR /&gt;
  compute divided;&lt;BR /&gt;
    divided = height.sum / age.sum;&lt;BR /&gt;
  endcomp;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
    &lt;BR /&gt;
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:&lt;BR /&gt;
&lt;B&gt;varname.statistic&lt;/B&gt;&lt;BR /&gt;
which means age.sum and height.sum need to be used in the compute block.&lt;BR /&gt;
   &lt;BR /&gt;
 So you were -almost- there try this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
if Coveragecode = 'MC' then Frequency = Claimcount.sum / EarnedCov.sum;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
cynthia</description>
      <pubDate>Tue, 03 Mar 2009 16:07:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Computed-Variables/m-p/76083#M22093</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-03-03T16:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Report Computed Variables.</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Computed-Variables/m-p/76084#M22094</link>
      <description>Thank you Cyntia.  You are a gem.</description>
      <pubDate>Wed, 04 Mar 2009 01:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Proc-Report-Computed-Variables/m-p/76084#M22094</guid>
      <dc:creator>Scottcom4</dc:creator>
      <dc:date>2009-03-04T01:21:16Z</dc:date>
    </item>
  </channel>
</rss>

