<?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 Calculating response rates in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754618#M238007</link>
    <description>&lt;P&gt;Hi Everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to calculate response rates for a survey conducted. I have a sample dataset below but the actual dataset contains many more participants and variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
input ID  var1 var2 var3 var4 var5;
datalines;
1 3 4 1 3 .
2 2 . 3 1 .
3 1 . 3 2 4
4 1 . 4 4 6
5 1 1 1 . .
6 . 2 . 3 .
7 2 1 1 . 1
8 . 1 4 . 4
9 2 6 . 1 .
10 . . . . .
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have three tiers of response rates.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) "Response" defined as anyone who returns a survey and answers &lt;U&gt;&amp;gt;&lt;/U&gt;1 question&lt;/P&gt;&lt;P&gt;2) "Partial Completion" defined as anyone who returns a survey with 50-80% of the questions responded to&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) "Completion" defined as anyone who returns a survey with &lt;U&gt;&amp;gt;&lt;/U&gt; 80% of the questions responded to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imagine calculating this involves me creating a new variable that uses if/then and do statements to look at missing and non missing cells to calculate response rates based on the levels above, but I'm confused as to how to go about it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for reading!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jul 2021 15:41:54 GMT</pubDate>
    <dc:creator>mitrakos</dc:creator>
    <dc:date>2021-07-16T15:41:54Z</dc:date>
    <item>
      <title>Calculating response rates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754618#M238007</link>
      <description>&lt;P&gt;Hi Everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to calculate response rates for a survey conducted. I have a sample dataset below but the actual dataset contains many more participants and variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
input ID  var1 var2 var3 var4 var5;
datalines;
1 3 4 1 3 .
2 2 . 3 1 .
3 1 . 3 2 4
4 1 . 4 4 6
5 1 1 1 . .
6 . 2 . 3 .
7 2 1 1 . 1
8 . 1 4 . 4
9 2 6 . 1 .
10 . . . . .
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have three tiers of response rates.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) "Response" defined as anyone who returns a survey and answers &lt;U&gt;&amp;gt;&lt;/U&gt;1 question&lt;/P&gt;&lt;P&gt;2) "Partial Completion" defined as anyone who returns a survey with 50-80% of the questions responded to&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) "Completion" defined as anyone who returns a survey with &lt;U&gt;&amp;gt;&lt;/U&gt; 80% of the questions responded to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imagine calculating this involves me creating a new variable that uses if/then and do statements to look at missing and non missing cells to calculate response rates based on the levels above, but I'm confused as to how to go about it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for reading!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 15:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754618#M238007</guid>
      <dc:creator>mitrakos</dc:creator>
      <dc:date>2021-07-16T15:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating response rates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754623#M238012</link>
      <description>&lt;P&gt;I don't think your sample data is reflective of your actual data - you likely will have a mix of character and numeric variables for one thing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data recoded;
set sample;

array Q_num (*) &amp;lt;list of numeric variables&amp;gt;;
array Q_char(*) &amp;lt;list of character variables&amp;gt;;

char_filled = dim(q_char) - cmiss(Q_char);
num_filled = n(q_num);
tot_filled = char_filled + num_filled;
pct_filled = tot_filled / (dim(q_char) + dim(q_num));

if    0.5&amp;lt;=pct_filled &amp;lt;0.8 then response = "Partial Completion";
else if pct_filled &amp;gt;=0.8 then response = "Completed";
else response ="TODO";

run;


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351308"&gt;@mitrakos&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Everyone!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm looking to calculate response rates for a survey conducted. I have a sample dataset below but the actual dataset contains many more participants and variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
input ID  var1 var2 var3 var4 var5;
datalines;
1 3 4 1 3 .
2 2 . 3 1 .
3 1 . 3 2 4
4 1 . 4 4 6
5 1 1 1 . .
6 . 2 . 3 .
7 2 1 1 . 1
8 . 1 4 . 4
9 2 6 . 1 .
10 . . . . .
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have three tiers of response rates.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) "Response" defined as anyone who returns a survey and answers &lt;U&gt;&amp;gt;&lt;/U&gt;1 question&lt;/P&gt;
&lt;P&gt;2) "Partial Completion" defined as anyone who returns a survey with 50-80% of the questions responded to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) "Completion" defined as anyone who returns a survey with &lt;U&gt;&amp;gt;&lt;/U&gt; 80% of the questions responded to&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I imagine calculating this involves me creating a new variable that uses if/then and do statements to look at missing and non missing cells to calculate response rates based on the levels above, but I'm confused as to how to go about it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for reading!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 16:21:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754623#M238012</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-16T16:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating response rates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754624#M238013</link>
      <description>&lt;P&gt;No, its simpler than that. You can use the N() and NMISS() functions to determine the number of questions answered and the number of questions not answered. From there, you can compute the percent of questions answered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set sample;
    n_answered=n(of var1-var5);
    n_not_answered=nmiss(of var1-var5);
    /* HOMEWORK ASSIGNMENT: Compute percents and tiers here */
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Jul 2021 16:21:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754624#M238013</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-07-16T16:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating response rates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754626#M238015</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;Thanks for the concern. The variables in use on the actual survey are all numeric, as they are coded with numeric labels that correspond to survey responses.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 16:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754626#M238015</guid>
      <dc:creator>mitrakos</dc:creator>
      <dc:date>2021-07-16T16:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating response rates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754628#M238017</link>
      <description>This works perfectly! Thank you!!</description>
      <pubDate>Fri, 16 Jul 2021 16:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754628#M238017</guid>
      <dc:creator>mitrakos</dc:creator>
      <dc:date>2021-07-16T16:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating response rates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754629#M238018</link>
      <description>&lt;P&gt;Are your variables Var1 through Varn all of the same type?&lt;/P&gt;
&lt;P&gt;You should show what you expect the result to be.&lt;/P&gt;
&lt;P&gt;This will give you the percent of completed questions&lt;/P&gt;
&lt;PRE&gt;data want;
   set sample;
   array v (*) var1-var5; /*&amp;lt;this statement requires all the variables to be of the same numeric type*/
   PercentComplete=  (n(of v(*))/dim(v));
run;&lt;/PRE&gt;
&lt;P&gt;IF all of var1 to varn are numeric.&lt;/P&gt;
&lt;P&gt;If you have a mix of variable types then you need another method to count how many variables have been completed.&lt;/P&gt;
&lt;P&gt;That can be done with something like&lt;BR /&gt;You can apply a custom format to Percentcomplete to show range as which type or an If/then/else.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 16:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754629#M238018</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-07-16T16:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating response rates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754641#M238024</link>
      <description>&lt;P&gt;FYI - none of these will correctly account for skip logic type questions. Depending on what you're doing with this, that may or may not be important.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 17:14:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754641#M238024</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-07-16T17:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating response rates</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754643#M238026</link>
      <description>Indeed! I believe these questions do not involve skip logic. The questions chosen are a set of “core” questions the investigators feel that are important and other questions are not involved in response rate calculation.&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Jul 2021 17:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-response-rates/m-p/754643#M238026</guid>
      <dc:creator>mitrakos</dc:creator>
      <dc:date>2021-07-16T17:16:58Z</dc:date>
    </item>
  </channel>
</rss>

