<?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 PROC REPORT and caculating rates in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/618599#M23708</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use the PROC REPORT for the first time. I would like to describe the number of people registered for a game in comparison with the number of people interviewed, depending on the country and the week. In fact, I would like to build a table with 3 columns (CF attachment) for each week:&amp;nbsp;&lt;/P&gt;&lt;P&gt;- number of registrants&lt;/P&gt;&lt;P&gt;- number of contacted&lt;/P&gt;&lt;P&gt;- registration rates (number of people registered divided by the number of people interviewed)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some data:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input week country $ inscrip;
datalines;
45 france 1
45 france 1
45 france 0
45 espagne 1
45 espagne 0
45 espagne 0
45 espagne 0
45 espagne 0
46 france 1
46 france 1
46 france 1
46 france 0
46 france 0
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code. I can display the columns of people registered and contacted for each week and by country. However, I can't display registration rates for each week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REPORT data=test nowindows completerows;
columns COUNTRY (WEEK, (INSCRIP n RATE))(INSCRIP n RATE);
define COUNTRY / group ;
define WEEK / across;
define INSCRIP / analysis sum;
define n / "Registrants";
define RATE / computed format=NLPCTN12.2;
compute RATE;
RATE=inscrip.sum/n;
endcomp;
rbreak after / summarize;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error is: "ERROR: COMPUTED conflicts with earlier use of taux". Is there any solution ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Garpe&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2020 09:45:52 GMT</pubDate>
    <dc:creator>Garpe</dc:creator>
    <dc:date>2020-01-22T09:45:52Z</dc:date>
    <item>
      <title>PROC REPORT and caculating rates</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/618599#M23708</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to use the PROC REPORT for the first time. I would like to describe the number of people registered for a game in comparison with the number of people interviewed, depending on the country and the week. In fact, I would like to build a table with 3 columns (CF attachment) for each week:&amp;nbsp;&lt;/P&gt;&lt;P&gt;- number of registrants&lt;/P&gt;&lt;P&gt;- number of contacted&lt;/P&gt;&lt;P&gt;- registration rates (number of people registered divided by the number of people interviewed)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some data:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input week country $ inscrip;
datalines;
45 france 1
45 france 1
45 france 0
45 espagne 1
45 espagne 0
45 espagne 0
45 espagne 0
45 espagne 0
46 france 1
46 france 1
46 france 1
46 france 0
46 france 0
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code. I can display the columns of people registered and contacted for each week and by country. However, I can't display registration rates for each week.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC REPORT data=test nowindows completerows;
columns COUNTRY (WEEK, (INSCRIP n RATE))(INSCRIP n RATE);
define COUNTRY / group ;
define WEEK / across;
define INSCRIP / analysis sum;
define n / "Registrants";
define RATE / computed format=NLPCTN12.2;
compute RATE;
RATE=inscrip.sum/n;
endcomp;
rbreak after / summarize;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error is: "ERROR: COMPUTED conflicts with earlier use of taux". Is there any solution ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Garpe&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 09:45:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/618599#M23708</guid>
      <dc:creator>Garpe</dc:creator>
      <dc:date>2020-01-22T09:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT and caculating rates</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/618940#M23712</link>
      <description>&lt;P&gt;It may help to show the expected results for your given data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may consider:&lt;/P&gt;
&lt;PRE&gt;PROC REPORT data=test nowindows completerows;
columns COUNTRY WEEK, (INSCRIP,( n mean));
define COUNTRY / group ;
define WEEK / across;
define INSCRIP / analysis ;
define mean/ format=percent8.1 "Rate";
define n / "Adresses";
rbreak after / summarize;
RUN;&lt;/PRE&gt;
&lt;P&gt;The Mean of a 0/1 coded variable is the percent of 1 values.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 19:34:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/618940#M23712</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-01-21T19:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT and caculating rates</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/619066#M23713</link>
      <description>&lt;P&gt;Many thanks (&lt;SPAN&gt;the expected results is on attachment)&amp;nbsp;&lt;/SPAN&gt;! That's exactly what I need. Now the solution seems obvious !&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However I have a last question... I have difficulties with the cross and I don't know how to add a column (next to the contacted and the registration rate column) with the registrants by country and week, a suggestion ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;[EDIT]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I don't know if this is the optimal solution but the following code runs&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;PROC REPORT data=test nowindows completerows;
columns COUNTRY WEEK, (INSCRIP INSCRIP,( n mean));
define COUNTRY / group ;
define WEEK/ across;
define INSCRIP / analysis ;
define mean/ format=percent8.1 "Rate";
define n / "Contacted";
rbreak after / summarize;
RUN;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;Garpe&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 09:28:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/619066#M23713</guid>
      <dc:creator>Garpe</dc:creator>
      <dc:date>2020-01-22T09:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT and caculating rates</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/619251#M23714</link>
      <description>&lt;P&gt;If I understand your question here's a hint: The SUM of a 0/1 coded variable is the number of 1's. perhaps you just want to add SUM in an appropriate location.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2020 17:51:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/619251#M23714</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-01-22T17:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: PROC REPORT and caculating rates</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/620460#M23726</link>
      <description>&lt;P&gt;Yes, I was thinking about adding a SUM but there were errors in my code.&amp;nbsp;I tried again thanks to your post and I finally found a solution:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PROC REPORT data=test nowindows completerows;
columns country WEEK, (INSCRIP,(sum n mean));
define COUNTRY / group ;
define WEEK / across;
define INSCRIP / analysis ;
define mean/ format=percent8.1 "Rate";
define n / "Adresses";
rbreak after / summarize;
RUN;&lt;/PRE&gt;&lt;P&gt;Thanks, it will help me a lot!&lt;/P&gt;&lt;P&gt;Garpe&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 11:02:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/PROC-REPORT-and-caculating-rates/m-p/620460#M23726</guid>
      <dc:creator>Garpe</dc:creator>
      <dc:date>2020-01-28T11:02:13Z</dc:date>
    </item>
  </channel>
</rss>

