<?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: how to count passing rate if there are two different exams for one examee in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377754#M90730</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data exam;
input regno $ exam $ c $;
datalines;
111 AA Pass
111 BB Pass
222 AA Pass
222 BB Fail
333 AA Fail
333 BB Pass
444 AA Pass
444 BB Pass
555 AA Fail
555 BB Fail
666 AA Fail
666 BB Pass
777 AA Pass
777 BB Fail
888 AA Fail
888 BB Pass
999 AA Pass
999 BB Pass
123 AA Fail
123 BB Pass
;
run;
title 'the number of Both Pass';
proc sql;
 select count(*) as n
  from (select distinct regno 
from exam
where c='Pass'
group by regno 
having count(distinct exam)=2);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Jul 2017 13:32:04 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2017-07-20T13:32:04Z</dc:date>
    <item>
      <title>how to count passing rate if there are two different exams for one examee</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377511#M90650</link>
      <description>&lt;P&gt;Hi SAS guys,&lt;/P&gt;&lt;P&gt;I have problem with counting. Here are my data:&lt;/P&gt;&lt;P&gt;data exam;&lt;BR /&gt;input regno $6. exam $4. grade $5.;&lt;BR /&gt;datalines;&lt;BR /&gt;111 AA Pass&lt;BR /&gt;111 BB Pass&lt;BR /&gt;222 AA Pass&lt;BR /&gt;222 BB Fail&lt;BR /&gt;333 AA Fail&lt;BR /&gt;333 BB Pass&lt;BR /&gt;444 AA Pass&lt;BR /&gt;444 BB Pass&lt;BR /&gt;555 AA Fail&lt;BR /&gt;555 BB Fail&lt;BR /&gt;666 AA Fail&lt;BR /&gt;666 BB Pass&lt;BR /&gt;777 AA Pass&lt;BR /&gt;777 BB Fail&lt;BR /&gt;888 AA Fail&lt;BR /&gt;888 BB Pass&lt;BR /&gt;999 AA Pass&lt;BR /&gt;999 BB Pass&lt;BR /&gt;123 AA Fail&lt;BR /&gt;123 BB Pass&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know how many candidates pass both of two exams, how many candidates pass AA exam and how many candidates pass BB exam. Thank a lot!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 18:43:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377511#M90650</guid>
      <dc:creator>daisy6</dc:creator>
      <dc:date>2017-07-19T18:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: how to count passing rate if there are two different exams for one examee</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377516#M90654</link>
      <description>&lt;P&gt;Why not just limit it to the "Pass" then?&lt;/P&gt;
&lt;P&gt;Assuming a student cannot 'Pass' the same exam twice this should work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=exam;
where grade='Pass';
table exam;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Jul 2017 18:53:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377516#M90654</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-07-19T18:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: how to count passing rate if there are two different exams for one examee</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377521#M90659</link>
      <description>&lt;P&gt;Thank Reeza for the reply. But the freq table only gives me exam AA or BB passing rate. Not both of AA and BB passing rate&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 18:58:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377521#M90659</guid>
      <dc:creator>daisy6</dc:creator>
      <dc:date>2017-07-19T18:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to count passing rate if there are two different exams for one examee</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377525#M90663</link>
      <description>&lt;P&gt;This approach should work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set exam;&lt;/P&gt;
&lt;P&gt;by regno;&lt;/P&gt;
&lt;P&gt;length results $ 20;&lt;/P&gt;
&lt;P&gt;retain results;&lt;/P&gt;
&lt;P&gt;if first.regno then results = catx(' ', exam, grade);&lt;/P&gt;
&lt;P&gt;else results = catx(' ', results, exam, grade);&lt;/P&gt;
&lt;P&gt;if last.regno;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=want;&lt;/P&gt;
&lt;P&gt;tables results;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 19:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377525#M90663</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-19T19:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to count passing rate if there are two different exams for one examee</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377536#M90668</link>
      <description>It works !Thanks for that !&lt;BR /&gt;Do you still have another way to do that?</description>
      <pubDate>Wed, 19 Jul 2017 19:14:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377536#M90668</guid>
      <dc:creator>daisy6</dc:creator>
      <dc:date>2017-07-19T19:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to count passing rate if there are two different exams for one examee</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377544#M90672</link>
      <description>&lt;P&gt;Another way?&amp;nbsp; How about:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;merge have (where=(exam='AA')) have (where=(exam='BB') rename=(exam=exam2 grade=grade2));&lt;/P&gt;
&lt;P&gt;by regno;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=want;&lt;/P&gt;
&lt;P&gt;tables exam * grade * exam2 * grade2 / missing list;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm pretty sure the first DATA step works as is, but there is a small chance that the combination of WHERE + RENAME requires a small change.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 19:29:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377544#M90672</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-19T19:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: how to count passing rate if there are two different exams for one examee</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377620#M90693</link>
      <description>&lt;P&gt;Please note that your code as pasted will not run correctly. The message window sometimes "adjusts" blank spaces. Post code after verifying that it runs correctly into a code box opened&amp;nbsp;using the forum {i} menu icon.&lt;/P&gt;
&lt;P&gt;the values I got running your code as is generated:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="left"&gt;
&lt;TABLE class="table" cellspacing="0" cellpadding="3" summary="Procedure Print: Data Set USER.EXAM"&gt;&lt;COLGROUP&gt; &lt;COL /&gt; &lt;COL /&gt; &lt;COL /&gt;&lt;/COLGROUP&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="c m header" scope="col"&gt;regno&lt;/TH&gt;
&lt;TH class="c m header" scope="col"&gt;exam&lt;/TH&gt;
&lt;TH class="c m header" scope="col"&gt;grade&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;111 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;111 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;222 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;222 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Fai&lt;/TD&gt;
&lt;TD class="l data"&gt;l&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;333 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Fai&lt;/TD&gt;
&lt;TD class="l data"&gt;l&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;333 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;444 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;444 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;555 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Fai&lt;/TD&gt;
&lt;TD class="l data"&gt;l&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;555 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Fai&lt;/TD&gt;
&lt;TD class="l data"&gt;l&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;666 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Fai&lt;/TD&gt;
&lt;TD class="l data"&gt;l&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;666 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;777 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;777 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Fai&lt;/TD&gt;
&lt;TD class="l data"&gt;l&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;888 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Fai&lt;/TD&gt;
&lt;TD class="l data"&gt;l&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;888 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;999 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;999 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;123 AA&lt;/TD&gt;
&lt;TD class="l data"&gt;Fai&lt;/TD&gt;
&lt;TD class="l data"&gt;l&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class="l data"&gt;123 BB&lt;/TD&gt;
&lt;TD class="l data"&gt;Pas&lt;/TD&gt;
&lt;TD class="l data"&gt;s&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 19 Jul 2017 23:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377620#M90693</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-07-19T23:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: how to count passing rate if there are two different exams for one examee</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377754#M90730</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data exam;
input regno $ exam $ c $;
datalines;
111 AA Pass
111 BB Pass
222 AA Pass
222 BB Fail
333 AA Fail
333 BB Pass
444 AA Pass
444 BB Pass
555 AA Fail
555 BB Fail
666 AA Fail
666 BB Pass
777 AA Pass
777 BB Fail
888 AA Fail
888 BB Pass
999 AA Pass
999 BB Pass
123 AA Fail
123 BB Pass
;
run;
title 'the number of Both Pass';
proc sql;
 select count(*) as n
  from (select distinct regno 
from exam
where c='Pass'
group by regno 
having count(distinct exam)=2);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jul 2017 13:32:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377754#M90730</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-07-20T13:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to count passing rate if there are two different exams for one examee</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377811#M90741</link>
      <description>&lt;P&gt;Another way is by using proc transpose and proc freq shown as below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data exam;&lt;BR /&gt;input regno $ exam $ c $;&lt;BR /&gt;datalines;&lt;BR /&gt;111 AA Pass&lt;BR /&gt;111 BB Pass&lt;BR /&gt;222 AA Pass&lt;BR /&gt;222 BB Fail&lt;BR /&gt;333 AA Fail&lt;BR /&gt;333 BB Pass&lt;BR /&gt;444 AA Pass&lt;BR /&gt;444 BB Pass&lt;BR /&gt;555 AA Fail&lt;BR /&gt;555 BB Fail&lt;BR /&gt;666 AA Fail&lt;BR /&gt;666 BB Pass&lt;BR /&gt;777 AA Pass&lt;BR /&gt;777 BB Fail&lt;BR /&gt;888 AA Fail&lt;BR /&gt;888 BB Pass&lt;BR /&gt;999 AA Pass&lt;BR /&gt;999 BB Pass&lt;BR /&gt;123 AA Fail&lt;BR /&gt;123 BB Pass&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sort data=exam; by regno; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc transpose data=exam out=temp;&lt;BR /&gt;by regno;&lt;BR /&gt;id exam;&lt;BR /&gt;var c;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data temp1;&lt;BR /&gt;set temp;&lt;BR /&gt;result=catx('-',AA,BB);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc freq;&lt;BR /&gt;table result;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="branch"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 20 Jul 2017 15:32:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-count-passing-rate-if-there-are-two-different-exams-for/m-p/377811#M90741</guid>
      <dc:creator>rahuljhaver</dc:creator>
      <dc:date>2017-07-20T15:32:03Z</dc:date>
    </item>
  </channel>
</rss>

