<?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 can I select all that apply in SAS 9.4 for survey question? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-select-all-that-apply-in-SAS-9-4-for-survey-question/m-p/861230#M340194</link>
    <description>&lt;P&gt;This looks like it very likely a follow up to a question like "Did you get HPV vaccine?" In many surveys that means that the follow up question for "why not" would only be asked of those that said "No" to the "did you get" question. So would Your question response would be missing for any who said yes. If most of your respondents did get the vaccine and there is such a skip pattern then most of the responses you have created are from MISSING responses to the Why_did_not_get_HPV_vaccine question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might suggest, not having your data or full description of your survey that you try this if the skip pattern is in the survey:&lt;/P&gt;
&lt;PRE&gt;if not missing (Why_did_not_get_HPV_vaccine) then do;
   If find (Why_did_not_get_HPV_vaccine, "1") then Q185_1=1; else Q185_1=0;
   If find (Why_did_not_get_HPV_vaccine, "2") then Q185_2=1; else Q185_2=0;
   If find (Why_did_not_get_HPV_vaccine, "3") then Q185_3=1; else Q185_3=0;
   If find (Why_did_not_get_HPV_vaccine, "4") then Q185_4=1; else Q185_4=0;
   If find (Why_did_not_get_HPV_vaccine, "5") then Q185_5=1; else Q185_5=0;
   If find (Why_did_not_get_HPV_vaccine, "6") then Q185_6=1; else Q185_6=0;
   If find (Why_did_not_get_HPV_vaccine, "7") then Q185_7=1; else Q185_7=0;
   If find (Why_did_not_get_HPV_vaccine, "8") then Q185_8=1; else Q185_8=0;
   If find (Why_did_not_get_HPV_vaccine, "9") then Q185_9=1; else Q185_9=0;
   If find (Why_did_not_get_HPV_vaccine, "10") then Q185_10=1; else Q185_10=0;
end;&lt;/PRE&gt;
&lt;P&gt;The interpretation of your original code would "% of all respondents why not getting HPV".&lt;/P&gt;
&lt;P&gt;The above suggestion would be interpreted as "of those that did not get HPV vaccination, reasons why".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: instead of writing a bunch of IF then as above you can use&lt;/P&gt;
&lt;PRE&gt;Q185_10=(find (Why_did_not_get_HPV_vaccine, "10") );&lt;/PRE&gt;
&lt;P&gt;the ( ) around the find question will evaluate the expression inside as a logical and return 1 for true (find &amp;gt; 0) or 0 (find was 0) for false.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 Feb 2023 21:38:35 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-02-27T21:38:35Z</dc:date>
    <item>
      <title>How can I select all that apply in SAS 9.4 for survey question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-select-all-that-apply-in-SAS-9-4-for-survey-question/m-p/861130#M340159</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to figure out the frequency of respondents who selected each answer choice. Using SAS 9.4. There were 10 answer choices to my question. This question is a "select all you can apply" question. However, when I run my code, I get very small percentages. Here's my code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;If find (Why_did_not_get_HPV_vaccine, "1") then Q185_1=1; else Q185_1=0;
If find (Why_did_not_get_HPV_vaccine, "2") then Q185_2=1; else Q185_2=0;
If find (Why_did_not_get_HPV_vaccine, "3") then Q185_3=1; else Q185_3=0;
If find (Why_did_not_get_HPV_vaccine, "4") then Q185_4=1; else Q185_4=0;
If find (Why_did_not_get_HPV_vaccine, "5") then Q185_5=1; else Q185_5=0;
If find (Why_did_not_get_HPV_vaccine, "6") then Q185_6=1; else Q185_6=0;
If find (Why_did_not_get_HPV_vaccine, "7") then Q185_7=1; else Q185_7=0;
If find (Why_did_not_get_HPV_vaccine, "8") then Q185_8=1; else Q185_8=0;
If find (Why_did_not_get_HPV_vaccine, "9") then Q185_9=1; else Q185_9=0;
If find (Why_did_not_get_HPV_vaccine, "10") then Q185_10=1; else Q185_10=0;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are a portion of my results (the rest got cutoff in screenshot). As you can see, each answer has an extremely small percentage, which doesn't make sense. &lt;STRONG&gt;How would you recommend I change my coding so that I capture everyone who selected each answer choice?&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;P class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2023-02-27 at 11.15.38 AM 2.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/80899i32660D52688988F3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2023-02-27 at 11.15.38 AM 2.png" alt="Screen Shot 2023-02-27 at 11.15.38 AM 2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 27 Feb 2023 16:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-select-all-that-apply-in-SAS-9-4-for-survey-question/m-p/861130#M340159</guid>
      <dc:creator>early_stage</dc:creator>
      <dc:date>2023-02-27T16:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I select all that apply in SAS 9.4 for survey question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-select-all-that-apply-in-SAS-9-4-for-survey-question/m-p/861230#M340194</link>
      <description>&lt;P&gt;This looks like it very likely a follow up to a question like "Did you get HPV vaccine?" In many surveys that means that the follow up question for "why not" would only be asked of those that said "No" to the "did you get" question. So would Your question response would be missing for any who said yes. If most of your respondents did get the vaccine and there is such a skip pattern then most of the responses you have created are from MISSING responses to the Why_did_not_get_HPV_vaccine question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I might suggest, not having your data or full description of your survey that you try this if the skip pattern is in the survey:&lt;/P&gt;
&lt;PRE&gt;if not missing (Why_did_not_get_HPV_vaccine) then do;
   If find (Why_did_not_get_HPV_vaccine, "1") then Q185_1=1; else Q185_1=0;
   If find (Why_did_not_get_HPV_vaccine, "2") then Q185_2=1; else Q185_2=0;
   If find (Why_did_not_get_HPV_vaccine, "3") then Q185_3=1; else Q185_3=0;
   If find (Why_did_not_get_HPV_vaccine, "4") then Q185_4=1; else Q185_4=0;
   If find (Why_did_not_get_HPV_vaccine, "5") then Q185_5=1; else Q185_5=0;
   If find (Why_did_not_get_HPV_vaccine, "6") then Q185_6=1; else Q185_6=0;
   If find (Why_did_not_get_HPV_vaccine, "7") then Q185_7=1; else Q185_7=0;
   If find (Why_did_not_get_HPV_vaccine, "8") then Q185_8=1; else Q185_8=0;
   If find (Why_did_not_get_HPV_vaccine, "9") then Q185_9=1; else Q185_9=0;
   If find (Why_did_not_get_HPV_vaccine, "10") then Q185_10=1; else Q185_10=0;
end;&lt;/PRE&gt;
&lt;P&gt;The interpretation of your original code would "% of all respondents why not getting HPV".&lt;/P&gt;
&lt;P&gt;The above suggestion would be interpreted as "of those that did not get HPV vaccination, reasons why".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: instead of writing a bunch of IF then as above you can use&lt;/P&gt;
&lt;PRE&gt;Q185_10=(find (Why_did_not_get_HPV_vaccine, "10") );&lt;/PRE&gt;
&lt;P&gt;the ( ) around the find question will evaluate the expression inside as a logical and return 1 for true (find &amp;gt; 0) or 0 (find was 0) for false.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Feb 2023 21:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-select-all-that-apply-in-SAS-9-4-for-survey-question/m-p/861230#M340194</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-27T21:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I select all that apply in SAS 9.4 for survey question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-select-all-that-apply-in-SAS-9-4-for-survey-question/m-p/861257#M340209</link>
      <description>&lt;P&gt;Nice answer, until the last sentence:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;the ( ) around the find question will evaluate the expression inside as a logical and return 1 for true (find &amp;gt; 0) or 0 (find was 0) for false.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The parentheses are just grouping, so (2) is just 2 not True or False.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Perhaps you meant to include the 0&amp;lt; in the original expression. That will make a boolean result (with or without the extra parentheses).&amp;nbsp; PS Use FINDW() instead of FIND() and avoid false positives caused by finding '1' in '10'.&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Q185_10=( 0 &amp;lt; findw(Why_did_not_get_HPV_vaccine, "10") );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2023 01:30:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-select-all-that-apply-in-SAS-9-4-for-survey-question/m-p/861257#M340209</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-02-28T01:30:55Z</dc:date>
    </item>
  </channel>
</rss>

