<?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 Arrays? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/463465#M118078</link>
    <description>&lt;P&gt;I am trying to use an array to solve this problem, I have tried without but can't seem to get it&lt;/P&gt;&lt;P&gt;I have a adherence to medication scale compiled of responses to 6 questions,&lt;/P&gt;&lt;P&gt;My problem is I am only able to include participants in the final scale IF they have answered &lt;STRONG&gt;4&lt;/STRONG&gt;,&lt;STRONG&gt;5, or 6 Questions&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I can't seem to come up with a formula that enables me to get rid of the people who have only answered 2 or 3 questions........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code&lt;/P&gt;&lt;P&gt;First I have reversed a few using array which had reverse scales&lt;/P&gt;&lt;P&gt;data reverse;&lt;BR /&gt;set adherance;&lt;BR /&gt;array reverse{*} q1 q2 q3;&lt;BR /&gt;do j= 1 to 3;&lt;BR /&gt;reverse{j}=6-reverse{j};&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This reverses the 3 questions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then without using array I can get the mean and multiply it by 6 to get scale score&lt;/P&gt;&lt;P&gt;data adherancescore;&lt;BR /&gt;set reverse;&lt;BR /&gt;adscalescore=mean(q1 q2 q3 q4 q5 q6)*6;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works but also calculates an average when only 2 or 3 have been scored...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible using array to exclude all except who answered 4,5 or 6 of q1-q6 and then calculate the total score of these?&lt;/P&gt;</description>
    <pubDate>Sat, 19 May 2018 01:14:01 GMT</pubDate>
    <dc:creator>underarmnat</dc:creator>
    <dc:date>2018-05-19T01:14:01Z</dc:date>
    <item>
      <title>Arrays?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/463465#M118078</link>
      <description>&lt;P&gt;I am trying to use an array to solve this problem, I have tried without but can't seem to get it&lt;/P&gt;&lt;P&gt;I have a adherence to medication scale compiled of responses to 6 questions,&lt;/P&gt;&lt;P&gt;My problem is I am only able to include participants in the final scale IF they have answered &lt;STRONG&gt;4&lt;/STRONG&gt;,&lt;STRONG&gt;5, or 6 Questions&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I can't seem to come up with a formula that enables me to get rid of the people who have only answered 2 or 3 questions........&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code&lt;/P&gt;&lt;P&gt;First I have reversed a few using array which had reverse scales&lt;/P&gt;&lt;P&gt;data reverse;&lt;BR /&gt;set adherance;&lt;BR /&gt;array reverse{*} q1 q2 q3;&lt;BR /&gt;do j= 1 to 3;&lt;BR /&gt;reverse{j}=6-reverse{j};&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This reverses the 3 questions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then without using array I can get the mean and multiply it by 6 to get scale score&lt;/P&gt;&lt;P&gt;data adherancescore;&lt;BR /&gt;set reverse;&lt;BR /&gt;adscalescore=mean(q1 q2 q3 q4 q5 q6)*6;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works but also calculates an average when only 2 or 3 have been scored...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible using array to exclude all except who answered 4,5 or 6 of q1-q6 and then calculate the total score of these?&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 01:14:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/463465#M118078</guid>
      <dc:creator>underarmnat</dc:creator>
      <dc:date>2018-05-19T01:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/463467#M118079</link>
      <description>&lt;P&gt;Well, you didn't specify what a question contains if somebody didn't answer it.&amp;nbsp; If an unanswered question contains a missing value, you could use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if n(of q1-q6) &amp;gt; 3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if some other value, such as zero, represents "no answer", the programming would be different.&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 01:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/463467#M118079</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-05-19T01:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/463469#M118080</link>
      <description>&lt;P&gt;Hi Astounding it contains a . for missing data&lt;/P&gt;&lt;P&gt;so that works,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you use arrays for the mean calculation?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 01:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/463469#M118080</guid>
      <dc:creator>underarmnat</dc:creator>
      <dc:date>2018-05-19T01:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/463470#M118081</link>
      <description>&lt;P&gt;Yes, if it’s row wise.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mean(of var1-var6);&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2018 01:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/463470#M118081</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-19T01:39:33Z</dc:date>
    </item>
  </channel>
</rss>

